Priority: P2: Important
Affects Version/s: 5.7.1, 5.9.5, 5.12.4, 5.13.1
Fix Version/s: None
Component/s: Widgets: Widgets and Dialogs
Originally reported on SO and tracked down by myself (answer from Maxim Paperno): https://stackoverflow.com/questions/57743803/problem-in-restoring-floating-toolbar-for-qmainwindow
The information is all there, but I'll summarize. There are two observable issues but I think they stem from the same base problem.
- After restoring a floating QToolBar, minimizing the main window leaves the toolbar floating/visible on the screen.
- Also after restoring a floater one is unable to get focus into a widget on the toolbar, eg. to type into an editable combo box like in the demo (or line edit, spin box, or whatever). I did also test with using a QWidgetAction to wrap the widget, but of course it makes no difference.
If you drag the toolbar around after it is restored (but don't dock it), then both issues are resolved, which is how I tracked down the workaround. Which is to simply remove the X11BypassWindowManagerHint flag after the toolbar is shown initially in floating state.
Attached is an example using two toolbars, one "fixed" with the workaround and one standard. The differences in behavior can be readily observed. After running it initially, drag both toolbars out of the window and restart the app.
As a side, but seemingly related issue, there are problems with restoring floating `QDockWidget`s as well. But those are "fixed" by restoring the state after showing the main window. In recent versions if you restore before showing main window, the dock widgets don't hide when MW is minimized (just like the toolbars). In older versions (eg. 5.9) the dock widgets don't even show up. There seem to be a few issues filed for QDockWidget so maybe this is known... or a separate report could be filed. If nothing else, seems like the docs could mention it.