IIRC, changing the source explicitly evicts the image element from the cache, so you want to avoid that as much as possible. What you want is to create one Image element for each of the sources and alternate between which one is visible: true.
For instance:
// ImageFlipper.qml
Item {
id: root
property int index: 0;
Image { source: "source1.png"; visible: root.index == 0 }
Image { source: "source2.png"; visible: root.index == 1 }
Image { source: "source3.png"; visible: root.index == 2 }
Image { source: "source4.png"; visible: root.index == 3 }
Image { source: "source5.png"; visible: root.index == 4 }
}
↧