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

Minimum size hint ignored when adding widgets dynamically

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 4.8.7, 5.6.1
    • Widgets: Layout
    • None
    • macOS

    Description

      When adding widgets to a layout "later on" (so not in the constructor), the minimum size hint of these widgets is ignored. It is possible to shrink the window much further than should be possible.

      1. Create a QWidget, give it a layout. Connect QTimer::singleShot to a method that will add widgets to the layout. Resize the window as small as possible.
      2. I expected the window to stop getting smaller once the minimum size of the contained widgets is reached.
      3. The window keeps getting smaller.

      I have verified that this issue exists on Linux, Mac, and Windows.

      Code to reproduce the issue:
      http://www.qtcentre.org/threads/66606-Minimum-size-hint-ignored-when-adding-widgets-dynamically

      The code + project is also attached.

      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
            thecomet Alex Murray
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes