Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.14.1
-
None
Description
If we set a main window to modified and close a subwindow, the main window modified status is cleared. This can be reproduced in the official MDI subwindow example. Just close one of the subwindows and modified is cleared, ignoring the fact that we set it manually. This seems inconsistent with the documentation and confusing because it doesn't consider if the main window was modified by other child widgets, like if a tree view on the left was modified etc. I believe the issue is to do with QMdiSubwindowPrivate::removeButtonsFromMenuBar being called in the destructor, the thing which merges the subwindow title with the menubar.
MainWindow mainWin; mainWin.setWindowTitle("Main Window[*]"); mainWin.setWindowModified(true); const QStringList posArgs = parser.positionalArguments(); for (const QString &fileName : posArgs) mainWin.openFile(fileName); mainWin.show(); return app.exec();