I have two qmls among which one contain animation say animation.qml and one contain data say data.qml.
I want to run my animation.qml for animating the content inside data.qml for that purpose I want to access the QString of QProperty in another model.
How to achieve the same?
I tried creating alias for the already defined property but it is not working using syntax
property alias differentNameForProperty: currentNameOftheProperty
Thank you in advance.
Here is an example,
Marks.qml
Item {
Student {
id: student
}
Item {
SequentialAnimation {
id: animination1
NumberAnimation {
duration: 1250
target: student
property: student.newMarks
from: 0
to: 100
}
}
}
Connections {
target: marksModel
function onCallMarks() {
animination1.start()
}
}
}
Student.qml
Item {
id: id_parent
property double oldMarks: 10
property alias newMarks: oldMarks
// Using oldMarks to toggle
// the visibility of elements
}
When the animation run from Marks.qml for newMarks. The changes will take place in Student.qml for oldMarks and animation will be played.
I hope my explanation is clear.
Thanks
I don't know if this is what you want...your example isn't really working, so I stripped it down to a version that does, but it might not be what you intended.
Your example has an issue with the
propertyproperty in theNumberAnimation. This property is of typestring. So what you actually want to write isproperty: "newMarks"no need for the id prefix as this is already accomplished by thetargetproperty.