NumberAnimation can't refer to its parent SequentalAnimation
-
My code:
import QtQuick 2.5 import QtQuick.Window 2.2 Window { visible: true width: 640 height: 480 property double angle: 0 SequentialAnimation on angle { property int myDuration: 3000 // const NumberAnimation { from: -30.0 to: 30.0 duration: parent.myDuration easing.type: Easing.InOutSine } } }I get this error on the "
parent.myDuration" line:ReferenceError: parent is not defined
Any ideas?
-
My code:
import QtQuick 2.5 import QtQuick.Window 2.2 Window { visible: true width: 640 height: 480 property double angle: 0 SequentialAnimation on angle { property int myDuration: 3000 // const NumberAnimation { from: -30.0 to: 30.0 duration: parent.myDuration easing.type: Easing.InOutSine } } }I get this error on the "
parent.myDuration" line:ReferenceError: parent is not defined
Any ideas?
Tried referencing by
id? -
Hi! The
parentproperty is the visual parent of the basic visual QML typeItemand must not be confused with the parent QObject in a QObject tree. TheAnimationQML type is not derived fromItem(because it has no visual representation) and thus does not have a visual parent / noparentproperty. -
@kshegunov :
Sure, that works, but I was wondering why it doesn't work withparentas well.@Wieland :
Ok, thanks!