2018年5月6日

ParentChange

モジュール

QtQuick 2.0

クラス継承

QQuickParentChange → QQuickStateOperation (internal) → QObject

プロパティー

target: Item = null
parent: Item = null
x: QQmlScriptString = ""
y: QQmlScriptString = ""
width: QQmlScriptString = ""
height: QQmlScriptString = ""
scale: QQmlScriptString = ""
rotation: QQmlScriptString = ""

説明


target に指定したビジュアルオブジェクトの parent を変更する。

x、y、width、height、scale、rotation で指定しないものがあるとき、parent を変更するビジュアルオブジェクトのそれらの値は見掛けをそのままにするような parent 変更先ビジュアルオブジェクト座標系での値に変更される。つまり、x と y の座標値は parent 変更先ビジュアルオブジェクトから見た座標値になり、スケールは逆数に、角度は逆向きになって、parent を変更する前の見掛けを保つように変更される。

x、y、width、height、scale、rotation のいずれかあるいは複数に parent 変更先ビジュアルオブジェクトでのプロパティー値を設定すると ParentAnimation でアニメーション効果を付けられる。

サンプルコード switchparent.qml を参照。

プロパティーの説明

target: Item

parent を変更するビジュアルオブジェクト。

parent: Item

parent 変更先ビジュアルオブジェクト。

x: QQmlScriptString

parent 変更先ビジュアルオブジェクトでの x 座標値を指定する。

y: QQmlScriptString

parent 変更先ビジュアルオブジェクトでの y 座標値を指定する。

width: QQmlScriptString

parent 変更後の幅を指定する。

height: QQmlScriptString

parent 変更後の高さを指定する。

scale: QQmlScriptString

parent 変更後のスケールを指定する。

rotation: QQmlScriptString

parent 変更後の角度を指定する。

問題


兄弟関係にある複数ビジュアルオブジェクトの parent を変更しようとすると正しく動作しない場合がある。

参考情報

ParentAnimation

モジュール

QtQuick 2.0

クラス継承

QQuickParentAnimation →  QQuickAnimationGroup (internal) → QQuickAbstractAnimation (internal) → QObject

プロパティー

target: Item = null
newParent: Item = null
via: Item = null

シグナル

targetChanged()
newParentChanged()
viaChanged()

説明


サンプルコード switchparent.qml を参照。


プロパティーの説明

target: Item

newParent: Item

via: Item

parent 変更先のビジュアルオブジェクトが parent 変更元のビジュアルオブジェクトよりも描画順序が先の場合や parent 変更先と変更元のいずれかのビジュアルオブジェクトの clip が true に設定されている場合に、clip が false に設定されているビジュアルオブジェクトを指定して parent を変えるビジュアルオブジェクトが隠れないようにする。

問題


ParentAnimation のリファレンスには親ビジュアルオブジェクトの clip が true のときの via 使用について書かれているがビジュアルオブジェクトの描画順序のために via が必要なことが書かれていない。

参考情報