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

QMainWindow:restoreState doesnt restore width of QDockWidgets in maximized QMainWindow



    • 32edae5e268b968aff82f0713612eff2feffb4e1 (qt/qtbase/dev)
    • UI Bug Fixing Q1/2021


      This most probably relates to QTBUG-16252 but is slightly different and easy to reproduce.

      When saving the state of a mainwindow with a dockwidget in it, it will, on the next start, resize the dockwidgets at max only to a width which is the max available width of the dockwidget when the mainwindow was in normal state.

      The example project creates a mainwindow with a left dockwidget.

      Steps to reproduce:

      1. Compile and start (pic1.png)
      2. Maximize the App (pic2.png), resize the dockwidget (pic3.png) and close it
      3. Reopen the App and notice the wrong width of the qdockwidget (pic4.png)
      4. If you un-maximize the window you'll also notice that the width the qdockwidget had taken was the one which was at max available in this normal state (pic5.png).

      If you resize the app a bit wider and repeat the steps you'll see that the dockwidget gets also resized a bit wider.

      In my understanding the dockwidget has to be restored to the same size as it was when closing the app in the maximized state.


        1. DockWidgetTest.pro
          0.1 kB
          Adrian Jäkel
        2. main.cpp
          1 kB
          Adrian Jäkel
        3. pic1.png
          16 kB
          Adrian Jäkel
        4. pic2.png
          41 kB
          Adrian Jäkel
        5. pic3.png
          42 kB
          Adrian Jäkel
        6. pic4.png
          44 kB
          Adrian Jäkel
        7. pic5.png
          13 kB
          Adrian Jäkel

        Issue Links

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



              vhilshei Volker Hilsheimer
              adrian2k Adrian Jäkel
              10 Vote for this issue
              20 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes