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

Layout issues

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.9.3
    • Quick: Layouts
    • None

      I have several questions or even maybe bugs (I'm not sure).

      1. The following code: 

       

      import QtQuick
      import QtQuick.Controls
      import QtQuick.Layouts
      
      Window {
          width: 640
          height: 100
          visible: true
          title: qsTr("Hello World")    
          component R : Rectangle {
              Layout.fillWidth: true
              Layout.maximumWidth: 100
              Layout.fillHeight: true
              Layout.alignment: Qt.AlignLeft
          }    
          RowLayout
          {
              width: parent.width
              height: 100
              spacing: 0        
              R { color: "red" }        
              R { color: "green" }        
              R { color: "blue" }
          }
      }
      

      Produces the following: 

      Why are all these rectangles not aligned to the left as requested? I would expect it to produce the following instead: 

      Fow now, I have to use additional empty Item element (with Layout.fillWidth: true) to achieve this.

       

      2. The following code:

      import QtQuick
      import QtQuick.Controls
      import QtQuick.LayoutsWindow {
          width: 310
          height: 100
          visible: true
          title: qsTr("Hello World")    
          component R : Rectangle {
              Layout.fillWidth: true
              Layout.maximumWidth: 100
              Layout.fillHeight: true
              Layout.alignment: Qt.AlignLeft
          }    
          RowLayout
          {
              width: parent.width
              height: 100
              spacing: 0        
              R { color: "red" }        
              R { color: "green" }        
              R { color: "blue" }        
              Item {
                  Layout.fillWidth: true
                  Layout.minimumWidth: 1
                  Layout.preferredWidth: 1
              }
          }
      }
       

      Produces this:

      Why does the last element in the layout occupies so much space while I set preferred width to 1? It "eats" space from rectangles making them smaller then I would expect.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            alervd Alexander Dyagilev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes