Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-78293

Issues with restoring floating QToolBar upon application start



    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.7.1, 5.9.5, 5.12.4, 5.13.1
    • None
    • Linux/X11


      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.

      1. After restoring a floating QToolBar, minimizing the main window leaves the toolbar floating/visible on the screen.
      2. 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.


      Thank you,



        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mpaperno Maxim Paperno
            1 Vote for this issue
            3 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes