Positioner QML Type
ポジショナー内のアイテムがどこにあるかに関する詳細を含む、添付プロパティを提供します。詳細...
| Import Statement: | import QtQuick |
アタッチドプロパティ
- index : int
- isFirstItem : bool
- isLastItem : bool
詳細な説明
Positioner 型のオブジェクトは、Column、Row、Flow、または Grid 内の最上位の子アイテムにアタッチされます。このオブジェクトは、子アイテムが親の Column、Row、Flow、または Grid のレイアウト内でどこに位置しているかを判断できるプロパティを提供します。
たとえば、以下はRepeater を通じて作成された、16個の子矩形を持つGrid です。各Rectangle はPositioner.index を使用してGrid内でのインデックスを表示し、Positioner.isFirstItem を考慮して最初のアイテムは異なる色で表示されています:
Grid {
Repeater {
model: 16
Rectangle {
id: rect
width: 30; height: 30
border.width: 1
color: Positioner.isFirstItem ? "yellow" : "lightsteelblue"
Text { text: rect.Positioner.index }
}
}
}
添付のプロパティのドキュメント
Positioner.index : int [read-only attached]
このプロパティにより、アイテムはポジショナー内での自身のインデックスを決定できるようになります。
Positioner.isFirstItem : bool [read-only attached]
Positioner.isLastItem : bool [read-only attached]
これらのプロパティにより、そのアイテムがポジショナー内の最初または最後のアイテムであるかどうかを、それぞれ判別できるようになります。
© 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.