Hello again
Consider the following:
Code:
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"; } } } }
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:
Code:
OpacityAnimator on opacity{ id: opacityAnimation duration: 2500 running: true }
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