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

QDockWidget split position "jumps" when QMainWindow resized

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.12.0 Beta 1
    • 5.10.0
    • GUI: Window management
    • None

    Description

      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.

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes