Hello again
Consider the following:
Loader {
anchors.fill: parent
source: {
switch(typeRole)
{
case 0: {
console.log("Loaded text");
return "TextItem.qml";
}
case 1:{
console.log("Loaded image");
return "ImageItem.qml";
}
case 2:{
console.log("Loaded video");
return "VideoItem.qml";
}
}
}
}
Loader {
anchors.fill: parent
source: {
switch(typeRole)
{
case 0: {
console.log("Loaded text");
return "TextItem.qml";
}
case 1:{
console.log("Loaded image");
return "ImageItem.qml";
}
case 2:{
console.log("Loaded video");
return "VideoItem.qml";
}
}
}
}
To copy to clipboard, switch view to plain text mode
This loader, inside a delegate, creates an item depending on the role "typeRole" (which is a role declared in c++, returning an int), and like this I can create dynamic components in a model.
Now, I'm thinking about doing the same for animations. I want to create for example:
OpacityAnimator on opacity{
id: opacityAnimation
duration: 2500
running: true
}
OpacityAnimator on opacity{
id: opacityAnimation
duration: 2500
running: true
}
To copy to clipboard, switch view to plain text mode
But I want different animations (like XAnimator, YAnimator) without instantiating them in the Loader. Ideally would be a loader inside the previous loader, adding an animation, and switching it with a role, for example, "animationTypeRole".
Is this possible?
Because I have a LOT of possible animations to do, and this would be a BIG BIG list down the same qml document, thus making the dynamically loaded component not good, performance wise, because I would have to create so many animations for every component in the model.
Thank you
Bookmarks