StackLayout QML Type

StackLayout 클래스는 한 번에 하나의 항목만 표시되는 항목 스택을 제공합니다. 더 보기...

Import Statement: import QtQuick.Layouts
Inherits:

Item

속성

첨부 속성

  • index : int (since QtQuick.Layouts 1.15)
  • isCurrentItem : bool (since QtQuick.Layouts 1.15)
  • layout : StackLayout (since QtQuick.Layouts 1.15)

자세한 설명

이 유형을 보다 효율적으로 사용하려면 Qt Quick 레이아웃 모듈의 일반적인 메커니즘을 이해하는 것이 좋습니다. 자세한 내용은 Qt Quick 레이아웃 개요를 참조하세요.

현재 표시되는 항목은 currentIndex 속성을 설정하여 수정할 수 있습니다. 인덱스는 스택 레이아웃의 자식 순서에 해당합니다.

대부분의 다른 레이아웃과 달리 하위 항목의 Layout.fillWidthLayout.fillHeight 속성은 기본적으로 true 입니다. 따라서 하위 항목은 Layout.maximumWidth 또는 Layout.maximumHeight 이 방해하지 않는 한 기본적으로 스택 레이아웃의 크기와 일치하도록 채워집니다.

항목은 레이아웃에 항목의 부모를 다시 지정하여 레이아웃에 추가됩니다. 마찬가지로 레이아웃에서 항목의 부모를 다시 지정하여 제거합니다. 이 두 작업 모두 레이아웃의 count 속성에 영향을 줍니다.

다음 코드는 '자두' 사각형만 표시되는 StackLayout을 만듭니다.

StackLayout {
    id: layout
    anchors.fill: parent
    currentIndex: 1
    Rectangle {
        color: 'teal'
        implicitWidth: 200
        implicitHeight: 200
    }
    Rectangle {
        color: 'plum'
        implicitWidth: 300
        implicitHeight: 200
    }
}

스택 레이아웃의 항목은 이러한 첨부 프로퍼티를 지원합니다:

첨부 프로퍼티에 대한 자세한 내용은 여기를 참조하세요.

ColumnLayout, GridLayout, RowLayout, StackView, Qt Quick 레이아웃 개요도참조하세요 .

속성 문서

count : int [read-only]

이 속성은 레이아웃에 속한 항목의 수를 보유합니다.

StackLayout 의 자식인 항목만 레이아웃 후보가 됩니다.


currentIndex : int

이 속성은 현재 StackLayout 에 표시되는 하위 항목의 인덱스를 보유합니다. 기본적으로 빈 레이아웃의 경우 -1 이 되고, 그렇지 않으면 기본값은 0 (첫 번째 항목 참조)입니다.

6.5부터는 현재 인덱스보다 작거나 같은 인덱스에 새 항목을 삽입/제거하면 현재 인덱스는 증가/감소하지만 현재 항목은 유지됩니다.


첨부 속성 문서

StackLayout.index : int [read-only, since QtQuick.Layouts 1.15]

이 첨부 프로퍼티는 StackLayout 에 있는 각 자식 항목의 인덱스를 보유합니다.

이 프로퍼티는 QtQuick.Layouts 1.15에 도입되었습니다.

isCurrentItemlayout참조하십시오 .


StackLayout.isCurrentItem : bool [read-only, since QtQuick.Layouts 1.15]

이 자식이 StackLayout 의 현재 항목인 경우 이 첨부 프로퍼티는 true 입니다.

이 속성은 QtQuick.Layouts 1.15에 도입되었습니다.

indexlayout도 참조하십시오 .


StackLayout.layout : StackLayout [read-only, since QtQuick.Layouts 1.15]

이 첨부된 속성은 이 자식 항목을 관리하는 StackLayout 을 보유합니다.

이 속성은 QtQuick.Layouts 1.15에 도입되었습니다.

indexisCurrentItem도 참조하십시오 .


© 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.