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. RowLayout width can't change
Forum Updated to NodeBB v4.3 + New Features

RowLayout width can't change

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 682 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.
  • W Offline
    W Offline
    white
    wrote on last edited by
    #1

    Hello , I would like make the 'RowLayout' fill in the whole area like the parent rectangle.

    I am using the following code :

    import QtQuick 2.12

    import QtQuick.Controls 1.4
    import QtQuick.Layouts 1.12
    ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Scroll")

    Rectangle {
        id: inforWindow
        anchors.fill: parent
        color: "green"
        ColumnLayout {
            width: parent.width
            height: parent.height
            //Layout.fillWidth: true
            //Layout.fillHeight: true
            TextArea {
                id: inforText
                width: parent.width
    
    
                Layout.fillHeight: true
            }
            RowLayout {
                id:inforInput
                width: parent.width
                spacing: 6
                Layout.preferredHeight: 30
                Layout.minimumHeight:  30
                Layout.maximumHeight: 30
    
                ComboBox {
                    id: inforCombox
    
                    Layout.alignment : Qt.AlignLeft
                }
    
                Button {
    
                    Layout.alignment : Qt.AlignRight
                    text: qsTr("Enter")
                }
            }
    
        }
    
    }
    

    }

    /##^##
    Designer {
    D{i:0;height:436;width:640}
    }
    ##^##
    /

    but the result is like :
    I don't what is the wrong that the RowLayout width not change.

    Capture.PNG

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @white
      since your RowLayout is inside a ColumnLayout use Layout.fillWidth: true instead of width: parent.width

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      W 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @white
        since your RowLayout is inside a ColumnLayout use Layout.fillWidth: true instead of width: parent.width

        W Offline
        W Offline
        white
        wrote on last edited by
        #3

        @raven-worx , I have tried to change the code, but not work.

        1 Reply Last reply
        0
        • W Offline
          W Offline
          white
          wrote on last edited by
          #4

          I found adding the "Layout.minimumHeight" which can make it work
          Like the following code:

          Layout.minimumHeight: inforWindow.height - inforInput.height

          raven-worxR 1 Reply Last reply
          0
          • W white

            I found adding the "Layout.minimumHeight" which can make it work
            Like the following code:

            Layout.minimumHeight: inforWindow.height - inforInput.height

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            @white
            you can also plase a spacer item between the combobox and button items:

            Item  { Layout.fillWidth: true }
            

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            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