Qt Quick 例 - ポジショナー
こちらは、QMLのポジショナーに関するサンプル集です。

「ポジショナー」は、ポジショナーに関連する小規模なQMLサンプル集です。各サンプルは、特定のタイプや機能を強調した小さなQMLファイルです。詳細については、「Qt Quick における重要な概念 - 位置指定」をご覧ください。
例の動作確認
以下の手順でサンプルを実行できます:
- Qt Creator
Welcome モードを開き、Examples からサンプルを選択します。詳細については、「Qt Creator :チュートリアル:ビルドと実行」を参照してください。
- Qt Extension for Visual Studio Code
「Command Palette 」から「Qt: Open Qt examples 」コマンドを実行し、リストから例を選択します。詳細については、Qt Extension for Visual Studio Code の「チュートリアル: ビルドと実行」を参照してください。
トランジション
「Transitions」では、ポジショナー内のアイテムを表示または非表示にする際のアニメーション遷移が表示されます。このシーンには、Column 、Row 、Grid 、Flow といったさまざまなポジショナーに配置されたアイテムが含まれています。各ポジショナーには、「Transitions」として定義されたアニメーションが設定されています。
move: Transition {
NumberAnimation {
properties: "x,y"
easing.type: Easing.OutBounce
}
}「移動トランジション」は、他のアイテムの出現や消失によって位置がずれた際、ポジショナー内のアイテムがどのようにアニメーションするかを指定します。
add: Transition {
NumberAnimation {
properties: "x,y"
easing.type: Easing.OutBounce
}
}「add」トランジションは、アイテムがポジショナーに追加されたときにどのように表示されるかを指定します。
populate: Transition {
NumberAnimation {
properties: "x,y"
from: 200
duration: 100
easing.type: Easing.OutBounce
}
}「populate」トランジションは、親ポジショナーが最初に作成されたときに、その中のアイテムがどのように表示されるかを指定します。
アタッチされたプロパティ
「アタッチされたプロパティ」では、Positioner のアタッチされたプロパティを使用して、ポジショナー内のアイテムの位置を特定する方法について説明しています。
Rectangle {
id: green
color: "#80c342"
width: 100 * page.ratio
height: 100 * page.ratio
Text {
anchors.left: parent.right
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
text: qsTr("Index: %1%2%3").arg(parent.Positioner.index)
.arg(parent.Positioner.isFirstItem ? qsTr(" (First)") : "")
.arg(parent.Positioner.isLastItem ? qsTr(" (Last)") : "")
}
// When mouse is clicked, display the values of the positioner
MouseArea {
anchors.fill: parent
onClicked: column.showInfo(green.Positioner)
}
}© 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.