RowLayout width can't change
-
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. -
@white
since your RowLayout is inside a ColumnLayout useLayout.fillWidth: true
instead ofwidth: parent.width
-
@white
since your RowLayout is inside a ColumnLayout useLayout.fillWidth: true
instead ofwidth: parent.width
@raven-worx , I have tried to change the code, but not work.
-
I found adding the "Layout.minimumHeight" which can make it work
Like the following code:Layout.minimumHeight: inforWindow.height - inforInput.height
@white
you can also plase a spacer item between the combobox and button items:Item { Layout.fillWidth: true }