Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Not filling full column height in ColumnLayout
Forum Updated to NodeBB v4.3 + New Features

Not filling full column height in ColumnLayout

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 974 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eragon
    wrote on last edited by
    #1

    I have a simple QML design that consists of 2 components side by side then another component (named HUD) below that. The HUD should fill the remaining height but instead it leaves a gap.

    How can I make HUD fill all the available width. I am trying to achieve the 2nd image.

    enter image description here

    enter image description here

    Page {
        width: parent.width
        height: parent.height
    
        title: qsTr("Home")
    
        ColumnLayout {
            anchors.fill: parent
    
            RowLayout {
                Layout.fillWidth: true;
    
                StatusBar {
                    width: parent.width * 0.5;
                    height: parent.height * 0.1
                    anchors.left: parent.left;
                }
    
                MenuBar {
                    width: parent.width * 0.5;
                    height: parent.height * 0.1
                    anchors.right: parent.right;
                }
            }
    
            // The below should fill the remaining height but its not?
            HUD {
                Layout.fillWidth: true;
                Layout.fillHeight: true;
            }
    
        }
    }
    
    CKurduC 1 Reply Last reply
    0
    • E eragon

      I have a simple QML design that consists of 2 components side by side then another component (named HUD) below that. The HUD should fill the remaining height but instead it leaves a gap.

      How can I make HUD fill all the available width. I am trying to achieve the 2nd image.

      enter image description here

      enter image description here

      Page {
          width: parent.width
          height: parent.height
      
          title: qsTr("Home")
      
          ColumnLayout {
              anchors.fill: parent
      
              RowLayout {
                  Layout.fillWidth: true;
      
                  StatusBar {
                      width: parent.width * 0.5;
                      height: parent.height * 0.1
                      anchors.left: parent.left;
                  }
      
                  MenuBar {
                      width: parent.width * 0.5;
                      height: parent.height * 0.1
                      anchors.right: parent.right;
                  }
              }
      
              // The below should fill the remaining height but its not?
              HUD {
                  Layout.fillWidth: true;
                  Layout.fillHeight: true;
              }
      
          }
      }
      
      CKurduC Offline
      CKurduC Offline
      CKurdu
      wrote on last edited by CKurdu
      #2

      @eragon
      Hi,
      Try layout parameters like below.

       ColumnLayout {
              anchors.fill: parent
              Item{
              Layout.preferredHeight: parent.height * 0.1
              Layout.preferredWidth:parent.width
              RowLayout {
                  id:r
                  anchors.fill:parent
                  StatusBar {
                      Layout.preferredWidth: parent.width * 0.5;
                      Layout.preferredHeight: parent.height
                  }
      
                  MenuBar {
                      Layout.preferredWidth: parent.width * 0.5;
                      Layout.preferredHeight: parent.height
                  }
              }
              }
      
              // The below should fill the remaining height but its not?
              HUD {
                  Layout.fillWidth: true;
                  Layout.fillHeight: true;
                  Layout.alignment: Qt.AlignTop
              }
      
          }
      

      You reap what you sow it

      1 Reply Last reply
      1
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        As shown by the @CKurdu when you are using the Layouts, use preferredWidth & preferred Height properties. Avoid making mix and match like the above.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved