ParentAnimation QML Type
親の値の変化をアニメーション化する。詳細...
Import Statement: | import QtQuick |
Inherits: |
プロパティ
詳しい説明
ParentAnimation は、Item の親の変更をアニメーション化するために使用されます。
例えば、次のParentChange は、blueRect
がクリックされると、redRect
の子になるように変更します。ParentAnimation を含めることで、遷移中に適用されるNumberAnimation が定義され、アイテムが新しい親に移動する際のアニメーションがスムーズになります:
import QtQuick Item { width: 200; height: 100 Rectangle { id: redRect width: 100; height: 100 color: "red" } Rectangle { id: blueRect x: redRect.width width: 50; height: 50 color: "blue" states: State { name: "reparented" ParentChange { target: blueRect; parent: redRect; x: 10; y: 10 } } transitions: Transition { ParentAnimation { NumberAnimation { properties: "x,y"; duration: 1000 } } } MouseArea { anchors.fill: parent; onClicked: blueRect.state = "reparented" } } }
ParentAnimation には、任意の数のアニメーションを含めることができます。ParentAnimationには、任意の数のアニメーションを含めることができます。これらのアニメーションは並行して実行されます。順次実行するには、SequentialAnimation の中で定義します。
クリッピングが有効なアイテム間で再ペアレントする場合など、クリッピングが有効でない別のアイテムを経由して親の変更をアニメーション化すると便利な場合があります。このようなアイテムは、via プロパティを使用して設定できます。
ParentAnimation は通常、ParentChange と組み合わせてTransition 内で使用されます。この方法で使用されると、状態変更の間に発生したParentChange をアニメーション化します。これは、target プロパティを使用して特定のターゲット項目を設定することでオーバーライドできます。
Qt QuickとQt Quick Examples - Animationの Animation と Transitionsも参照してください 。
プロパティの説明
newParent : Item |
アニメーション先の新しい親。
ParentAnimation がTransition 内で定義されている場合、この値のデフォルトはTransition の終了状態で定義されている値です。
target : Item |
再ペアレントするアイテム。
トランジションで使用される場合、ターゲットが指定されないと、すべてのParentChange がParentAnimation によってアニメートされます。
via : Item |
経由で再ペアレントするアイテム。これは、古い親と新しい親の両方がクリップされている場合に、クリップされていないアニメーションを行う方法を提供します。
ParentAnimation { target: myItem via: topLevelItem // ... }
注: これは、ParentAnimation がTransition でParentChange と併用されている場合にのみ機能します。
© 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.