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

Widgets without ShrinkFlag should not be shrunk in a layout

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15, 6.5.3, 6.6
    • Widgets: Layout
    • None
    • All

    Description

      When a widget in a layout has a size policy without the `QSizePolicy::ShrinkFlag` bit set (e.g. `QSizePolicy::Fixed`, `QSizePolicy::Minimum`), and the parent widget is forced with a size smaller than ideal, currently the child widget is shrunk anyway.

      However according to the doc,

      QSizePolicy::Fixed 0 The QWidget::sizeHint() is the only acceptable alternative, so the widget can never grow or shrink (e.g. the vertical direction of a push button).
      QSizePolicy::Minimum GrowFlag The sizeHint() is minimal, and sufficient. The widget can be expanded, but there is no advantage to it being larger (e.g. the horizontal direction of a push button). It cannot be smaller than the size provided by sizeHint().

      it seems that such widgets should not be shrunk smaller than the `sizeHint()`.

       

      For example, open the attached .ui file with Qt Designer, click "Preview" and drag the right border of the previewed window to shrink it, the result looks like this (below one is the preview). I think the first row looks wrong. It should be just like the second row.

      Attachments

        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
            zwhfly WH Z
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes