StackLayout QML Type
StackLayout 클래스는 한 번에 하나의 항목만 표시되는 항목 스택을 제공합니다. 더 보기...
| Import Statement: | import QtQuick.Layouts |
| Inherits: |
속성
- count : int
- currentIndex : int
연관 속성
- index : int
(since QtQuick.Layouts 1.15) - isCurrentItem : bool
(since QtQuick.Layouts 1.15) - layout : StackLayout
(since QtQuick.Layouts 1.15)
상세 설명
이 타입을 더 효율적으로 사용하려면, ` Qt Quick Layouts ` 모듈의 일반적인 작동 원리를 이해하는 것이 좋습니다. 자세한 내용은 Qt Quick Layouts Overview를 참조하십시오.
currentIndex 속성을 설정하여 현재 표시되는 항목을 변경할 수 있습니다. 이 인덱스는 StackLayout의 자식 요소 순서와 일치합니다.
대부분의 다른 레이아웃과 달리, 자식 항목의 ` Layout.fillWidth ` 및 ` Layout.fillHeight ` 속성은 기본적으로 ` true`으로 설정되어 있습니다. 그 결과, 자식 항목의 ` Layout.maximumWidth ` 또는 ` Layout.maximumHeight ` 속성이 이를 방해하지 않는 한, 자식 항목은 기본적으로 StackLayout의 크기에 맞춰 채워집니다.
항목은 해당 항목을 레이아웃으로 재할당하여 레이아웃에 추가됩니다. 마찬가지로, 제거는 해당 항목을 레이아웃에서 분리하여 수행됩니다. 이 두 작업 모두 레이아웃의 ` count ` 속성에 영향을 미칩니다.
다음 코드는 'plum' 사각형만 표시되는 StackLayout을 생성합니다.
StackLayout {
id: layout
anchors.fill: parent
currentIndex: 1
Rectangle {
color: 'teal'
implicitWidth: 200
implicitHeight: 200
}
Rectangle {
color: 'plum'
implicitWidth: 300
implicitHeight: 200
}
}StackLayout의 항목은 다음과 같은 첨부 속성을 지원합니다:
- Layout.minimumWidth
- Layout.minimumHeight
- Layout.preferredWidth
- Layout.preferredHeight
- Layout.maximumWidth
- Layout.maximumHeight
- Layout.fillWidth
- Layout.fillHeight
부착 속성에 대한 자세한 내용은 여기에서 확인하세요.
ColumnLayout, GridLayout, RowLayout, StackView 및 Qt Quick Layouts 개요도참조하십시오 .
속성 문서
count : int [read-only]
이 속성은 레이아웃에 속한 항목의 개수를 저장합니다.
StackLayout 의 자식 항목들만이 레이아웃 적용 대상이 됩니다.
currentIndex : int
이 속성은 현재 ‘ StackLayout ’에 표시된 자식 항목의 인덱스를 저장합니다. 기본적으로 레이아웃이 비어 있는 경우 -1 이며, 그렇지 않은 경우 기본값은 0 (첫 번째 항목을 가리킴)입니다.
6.5 버전부터는 현재 인덱스 이하 위치에 새 항목을 삽입하거나 제거할 경우, 현재 인덱스가 증가하거나 감소하지만 현재 항목은 유지됩니다.
첨부된 속성 문서
StackLayout.index : int [read-only attached, since QtQuick.Layouts 1.15]
이 첨부 속성은 ` StackLayout` 내 각 자식 항목의 인덱스를 저장합니다.
이 속성은 QtQuick.Layouts 1.15에서 도입되었습니다.
isCurrentItem 및 layout도 참조하십시오 .
StackLayout.isCurrentItem : bool [read-only attached, since QtQuick.Layouts 1.15]
이 자식 요소가 ` StackLayout`의 현재 항목인 경우, 이 첨부 속성의 값은 ` true `입니다.
이 속성은 QtQuick.Layouts 1.15에서 도입되었습니다.
StackLayout.layout : StackLayout [read-only attached, since QtQuick.Layouts 1.15]
이 첨부 속성은 이 자식 항목을 관리하는 ` StackLayout `를 포함합니다.
이 속성은 QtQuick.Layouts 1.15에서 도입되었습니다.
index 및 isCurrentItem도 참조하십시오 .
© 2026 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.