GridLayout QML Type
그리드에서 항목을 동적으로 정렬하는 방법을 제공합니다. 더 보기...
Import Statement: | import QtQuick.Layouts |
Inherits: |
속성
- columnSpacing : real
- columns : int
- flow : enumeration
- layoutDirection : enumeration
(since QtQuick.Layouts 1.1)
- rowSpacing : real
- rows : int
- uniformCellHeights : bool
(since QtQuick.Layouts 6.6)
- uniformCellWidths : bool
(since QtQuick.Layouts 6.6)
자세한 설명
이 유형을 보다 효율적으로 사용하려면 Qt Quick 레이아웃 모듈의 일반적인 메커니즘을 이해하는 것이 좋습니다. 자세한 내용은 Qt Quick 레이아웃 개요를 참조하세요.
GridLayout의 크기를 조정하면 레이아웃의 모든 항목이 재정렬됩니다. 위젯 기반 QGridLayout 과 유사합니다. GridLayout 요소의 보이는 모든 자식은 레이아웃에 속하게 됩니다. 하나의 행 또는 하나의 열만 있는 레이아웃을 원하는 경우 RowLayout 또는 ColumnLayout 을 사용하면 좀 더 편리한 API를 제공하고 가독성을 향상시킬 수 있습니다.
기본적으로 항목은 flow 속성에 따라 정렬됩니다. flow 속성의 기본값은 GridLayout.LeftToRight
입니다.
columns 속성을 지정하면 자동 위치 지정이 다음 행의 시작 부분으로 다시 래핑되기 전에 레이아웃이 가질 수 있는 열 수의 최대 제한으로 간주됩니다. columns 속성은 flow 이 GridLayout.LeftToRight
일 때만 사용됩니다.
GridLayout { id: grid columns: 3 Text { text: "Three"; font.bold: true; } Text { text: "words"; color: "red" } Text { text: "in"; font.underline: true } Text { text: "a"; font.pixelSize: 20 } Text { text: "row"; font.strikeout: true } }
rows 속성도 비슷한 방식으로 작동하지만 항목이 세로로 자동 배치됩니다. rows 속성은 flow 이 GridLayout.TopToBottom
일 때만 사용됩니다.
Layout.row 및 Layout.column 속성을 설정하여 항목이 차지할 셀을 지정할 수 있습니다. Layout.rowSpan 또는 Layout.columnSpan 속성을 설정하여 행 스팬 또는 열 스팬을 지정할 수도 있습니다.
그리드 레이아웃의 항목은 이러한 첨부 속성을 지원합니다:
- Layout.row
- Layout.column
- Layout.rowSpan
- Layout.columnSpan
- Layout.minimumWidth
- Layout.minimumHeight
- Layout.preferredWidth
- Layout.preferredHeight
- Layout.maximumWidth
- Layout.maximumHeight
- Layout.fillWidth
- Layout.fillHeight
- Layout.alignment
- Layout.margins
- Layout.leftMargin
- Layout.rightMargin
- Layout.topMargin
- Layout.bottomMargin
- Layout.horizontalStretchFactor
- Layout.verticalStretchFactor
첨부 속성에 대한 자세한 내용은 여기를 참조하세요.
RowLayout, ColumnLayout, StackLayout, Grid, Qt Quick 레이아웃 개요도참조하세요 .
속성 문서
columnSpacing : real |
이 속성은 각 열 사이의 간격을 유지합니다. 기본값은 5
입니다.
flow : enumeration |
layoutDirection : enumeration |
이 속성은 그리드 레이아웃의 레이아웃 방향을 유지하며, 항목이 왼쪽에서 오른쪽으로 배치될지 오른쪽에서 왼쪽으로 배치될지를 제어합니다. Qt.RightToLeft
을 지정하면 왼쪽 정렬 항목은 오른쪽으로 정렬되고 오른쪽 정렬 항목은 왼쪽으로 정렬됩니다.
사용 가능한 값
상수 | 설명 |
---|---|
Qt.LeftToRight | (기본값) 항목이 왼쪽에서 오른쪽으로 정렬됩니다. |
Qt.RightToLeft | 항목이 오른쪽에서 왼쪽으로 배치됩니다. |
이 프로퍼티는 QtQuick.Layouts 1.1에 도입되었습니다.
RowLayout::layoutDirection 및 ColumnLayout::layoutDirection 을참조하십시오 .
rowSpacing : real |
이 속성은 각 행 사이의 간격을 유지합니다. 기본값은 5
입니다.
uniformCellHeights : bool |
이 속성을 true
으로 설정하면 레이아웃에서 모든 셀의 높이가 균일하게 적용됩니다. 이 모드에서 레이아웃은 Layout.minimumHeight, Layout.preferredHeight 및 Layout.maximumHeight 을 준수하는 것을 목표로 하지만 모든 항목의 요구 사항을 충족하기 위해 타협을 할 수 있습니다.
기본값은 false
입니다.
이 속성은 QtQuick.Layouts 6.6에 도입되었습니다.
GridLayout::uniformCellWidths, RowLayout::uniformCellSizes, 및 ColumnLayout::uniformCellSizes 를참조하십시오 .
uniformCellWidths : bool |
이 속성을 true
로 설정하면 레이아웃은 모든 셀의 너비가 균일하도록 강제합니다. 이 모드에서 레이아웃은 Layout.minimumWidth, Layout.preferredWidth 및 Layout.maximumWidth 을 준수하는 것을 목표로 하지만 모든 항목의 요구 사항을 충족하기 위해 타협을 할 수 있습니다.
기본값은 false
입니다.
이 속성은 QtQuick.Layouts 6.6에 도입되었습니다.
GridLayout::uniformCellHeights, RowLayout::uniformCellSizes, ColumnLayout::uniformCellSizes 를참조하십시오 .
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.