StackLayout QML Type
StackLayoutクラスは、一度に1つのアイテムしか表示されないアイテムのスタックを提供します。詳細...
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 レイアウトの概要を参照してください。
現在の表示項目は、currentIndex プロパティを設定することで変更できます。インデックスはStackLayoutの子の順番に対応します。
他のほとんどのレイアウトとは対照的に、子アイテムのLayout.fillWidth とLayout.fillHeight プロパティのデフォルトはtrue
です。その結果、子アイテムは、Layout.maximumWidth またはLayout.maximumHeight がそれを妨げない限り、StackLayout のサイズに合わせてデフォルトで充填されます。
アイテムをレイアウトに追加するには、アイテムをレイアウトに再ペアレントします。同様に、アイテムの削除は、アイテムをレイアウトから再arentすることによって行われます。これらの操作はどちらもレイアウトの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のアイテムは、これらのattachedプロパティをサポートしています:
- Layout.minimumWidth
- Layout.minimumHeight
- Layout.preferredWidth
- Layout.preferredHeight
- Layout.maximumWidth
- Layout.maximumHeight
- Layout.fillWidth
- Layout.fillHeight
attachedプロパティの詳細については、こちらをご覧ください。
ColumnLayout,GridLayout,RowLayout,StackView,Qt Quick レイアウトの概要も参照してください 。
プロパティの説明
count : int |
このプロパティは、レイアウトに属するアイテムの数を保持します。
レイアウトの候補となるのは、StackLayout の子であるアイテムのみです。
currentIndex : int |
このプロパティは、StackLayout で現在表示されている子アイテムのインデックスを保持します。デフォルトでは、空のレイアウトの場合は-1
となり、そうでない場合は0
(最初のアイテムを参照)となります。
6.5以降、現在のインデックス以下のインデックスで新しいItemを挿入/削除すると、現在のインデックスが増加/減少しますが、現在のItemは保持されます。
付属プロパティの説明
StackLayout.index : int |
この Attached プロパティは、StackLayout 内の各子アイテムのインデックスを保持します。
このプロパティは、QtQuick.Layouts 1.15 で導入されました。
isCurrentItem およびlayoutも参照してください 。
StackLayout.isCurrentItem : bool |
この子がStackLayout の現在のアイテムである場合、この attached プロパティはtrue
になります。
このプロパティは QtQuick.Layouts 1.15 で導入されました。
StackLayout.layout : StackLayout |
この attached プロパティは、この子アイテムを管理するStackLayout を保持します。
このプロパティは QtQuick.Layouts 1.15 で導入されました。
index とisCurrentItem も参照して ください。
© 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.