왼쪽에서 오른쪽 RowLayout
에 Rectangle
을 정렬하고 싶습니다. 아래의 코드 예제에서 두 Rectangle
은 추가 공간을 공유합니다. RowLayout
레벨과 Rectangle
레벨에서 Layout.alignment: Qt.AlignLeft
을 사용했지만 두 가지 방법 중 어느 것도보기를 전혀 변경하지 않았습니다. 이미지를 검은 색 테두리는 다음의RowLayout에서 항목 정렬 방법
Item {
RowLayout {
anchors.fill: parent
spacing: 2
Rectangle {
width: 100
Layout.fillHeight: true
Layout.alignment: Qt.AlignLeft
Text {
text: "Hello world"
}
}
Rectangle {
width: 100
Layout.fillHeight: true
Layout.alignment: Qt.AlignLeft
Text {
text: "Hello world"
}
}
}
}
는 RowLayout
과 빨간색 테두리가 Rectangle
의 나타냅니다. 예상
'RowLayout' 대신'Row'를 사용하면 더 행복해 질 것입니다. 왜냐하면'Row'의 정상적인 동작이기 때문입니다. – derM
어린이 Items에 정적 너비가있는 경우 가로형 RowLayout을 사용하는 것은 나에게별로 의미가 없습니다. 대신 행을 사용하고 행의 높이에 어린이의 높이를 묶습니다. –