NumberAnimation can't refer to its parent SequentalAnimation
Solved
QML and Qt Quick
-
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
parent
property is the visual parent of the basic visual QML typeItem
and must not be confused with the parent QObject in a QObject tree. TheAnimation
QML type is not derived fromItem
(because it has no visual representation) and thus does not have a visual parent / noparent
property. -
@kshegunov :
Sure, that works, but I was wondering why it doesn't work withparent
as well.@Wieland :
Ok, thanks!