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

QDockWidget split position "jumps" when QMainWindow resized


    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.10.0
    • Fix Version/s: 5.12.0 Beta 1
    • Component/s: GUI: Window management
    • Labels:
    • Environment:


      See attached code with a QTableWidget inside a QDockWidget. If the user does any moving of the splitter for the dock widget, that positioning will be lost on any subsequent window resize.

      Also, default size policy of the QTableWidget or setting it to (Expanding, Expanding) will only show one column.  Overriding the sizeHint() seems the only way to get it to size to two columns.

      Reproduce by:

      • Dragging the splitter a bit from its starting position (could be expansion, could be contraction--doesn't matter)
      • Now drag the bottom edge of the window down a bit, and snap, it jumps back to the initial size (the sudden jump occurs right when the mouse first starts dragging).

      Changing the horizontal size policy from QSizePolicy::Preferred to QSizePolicy::Ignored doesn't seem to influence this behavior, not calling setStretchLastSection() doesn't seem to help either.

      Expected behavior:

      If the window is resized only vertically, the horizontal splitter should not move at all...and if it's resized horizontally then something more gradual should happen than a jump.

      Default behavior of QTableWidget should act as with the overridden sizeHint(), or failing that, setting to (Expanding, Expanding) should do it.


        1. mainwindow.cpp
          1 kB
        2. mainwindow.h
          0.3 kB
        3. step-1-initial-layout.png
          13 kB
        4. step-2-user-moves-splitter.png
          13 kB
        5. step-3-when-mainwindow-rezied.png
          14 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            • Assignee:
              qt.team.quick.subscriptions Qt Quick and Widgets Team
              hostilefork Brian Dickens
            • Votes:
              8 Vote for this issue
              13 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes