https://bugs.kde.org/show_bug.cgi?id=395988
Bug ID: 395988 Summary: KMainWindow saves invalid window/widget state under Qt 5.11.1 Product: frameworks-kxmlgui Version: 5.47.0 Platform: Archlinux Packages OS: Linux Status: UNCONFIRMED Severity: major Priority: NOR Component: general Assignee: kdelibs-b...@kde.org Reporter: max...@smoothware.net Target Milestone: --- Qt version 5.11.1 KDE Frameworks 5.47.0 Steps to Reproduce: 1. Start an application where mainwindow: - inherits KMainWindow (or KXmlGuiWindow) - contains some widget that has WA_NativeWindow attribute set (or calls QWidget::winId()) - whether WA_DontCreateNativeAncestors is set is irrelevant - contains usual QStatusBar, QMenuBar (handled by KMainWindow), optionally QDockWidgets and a central widget :) 2. Close application 3. Reopen the application 4. Application starts with status/menu bar and dock widgets hidden, only central widget is visible Additional information: Cause of the problem is following commit: http://code.qt.io/cgit/qt/qtbase.git/commit/?id=e0b5ff4ad583befbecbcbe462998e3ed80899531 - and is related to following Qt bug: https://bugreports.qt.io/browse/QTBUG-43344 I've posted a bug report here rather than on Qt's bug tracker as I'm not sure whether it should be worked around somehow in KMainWindow, since I'm not 100% sure it's actually bug in Qt. Above commit changed things so window close event gets handled by child widgets sooner... widgets get destroyed (and hidden) before QApplication::saveStateRequest triggers KMainWindow::saveState(). KMainWindow::saveMainWindowSettings() then calls QStatusBar/QMenuBar::isHidden() (which will return true) and updates rc file. In usual use cases when close event is handled, QMainWindow's children are destroyed without QWidget::hide() being ever called on them, and this issue won't happen. It seems that (in some cases) when one of the widgets has WA_NativeWindow flag set, all widgets get wrapped into QWindowWidget. In this case QMainWindow is destroyed with QWindowPrivate::destroy() and in turn child widgets (QMenuBar, QStatusBar, ...) are destroyed with QWindowPrivate::destroy() which also calls hide()/setVisible(false) on them and causes this issue. The application where I've encountered this issue is subtitle composer here https://github.com/maxrd2/subtitlecomposer. I haven't noticed this issue on other applications I'm using so far, I suppose WA_NativeWindow flag usage is not that common in apps that rely on KMainWindow. -- You are receiving this mail because: You are watching all bug changes.