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

Make qml layouts restrict parent window from being resized smaller than layout minimum size

    XMLWordPrintable

Details

    Description

      Current behavior:

      Window with a layout can be resized smaller than the minimum size of the layout by default. This has to be changed manually.

      import QtQuick 2.12
      import QtQuick.Window 2.12
      import QtQuick.Layouts 1.12
      
      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          RowLayout{
              id: layout
              anchors.fill: parent
      
              Rectangle{
                  color: "red"
      
                  Layout.minimumWidth: 100
                  Layout.minimumHeight: 100
              }
      
              Rectangle{
                  color: "green"
      
                  Layout.minimumWidth: 100
                  Layout.minimumHeight: 100
              }
      
              Rectangle{
                  color: "blue"
      
                  Layout.minimumWidth: 100
                  Layout.minimumHeight: 100
              }
          }
      }
      

      Desired behavior:

      Window with a layout automatically considers the layout size constraints and prevents Window from being resized smaller than the contained layout minimum size.

      Attachments

        Issue Links

          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
              miikapernu Miika Pernu
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes