Important: Please read the Qt Code of Conduct -

MainWindow or QDockWidget not resizing after undocking another QDockWidget .

  • Hi,
    I have a QMainWindow app which contains a QDockWidget at the top, and one at the bottom.

    When the dock at the top is undocked, a few widgets in the centralWidget are made visible. These widgets are made invisible again when the top-dock is docked again.

    The problem is that when undocking the top dock, the centralWidget correctly expands to show the newly visible widgets and moves up to correctly align with the top of the MainWindow.

    The bottom dock however, is not resized correctly: it aligns with the bottom of the centralWidget, but its height is not increased to fill up all the space at the bottom, leaving a large space between it and the status bar of the MainWindow. The docks have a minimum size, but no maximum size, and both are expanding correctly as the MainWindow is expanded.

    Note that the bottom dock will immediately resize to the full size as soon as I grab its resize corner, or the resize corner of the MainWindow.

    I tried using adjustSize() on the bottom dock when the upper dock is undocked, but this has no effect.

    How can I achieve this?


  • Lifetime Qt Champion


    Can you share the code you are currently using for that ?

Log in to reply