Unsolved Image disapear when charging
-
Hi,
what i want to do is change image to do a simple animation, so i used a timer to do that but when you change source of Image, the time it is charging there is a quick white moment.
I mean, normally the image should change only when it is loaded, so there would be always an Image seen, but when you change source to another one, then it flickers.
Is there a way to avoid that ?
Here is a code to illustrate that (i put cache: false like this u can see image is blank when it is charging else second time image is on cache so you can't see it).File Page1Form.ui.qml
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0Item {
property alias button1: button1
property alias button2: button2
property alias image: imageRowLayout { anchors.centerIn: parent Button { id: button1 text: qsTr("Press Me 1") } Button { id: button2 text: qsTr("Press Me 2") } Image { id: image width: 223 height: 159 cache: false asynchronous: true source: "" } }
}
File Page1.qml
import QtQuick 2.7
Page1Form {
button1.onClicked: {
console.log("Button 1 clicked.");
image.source="http://pngimg.com/upload/computer_pc_PNG7714.png"
}
button2.onClicked: {
console.log("Button 2 clicked.");
image.source="http://www.wiu.edu/academics/majors/business_and_technology/images/desktop_computer_512.png"
}
}Thanks
Sincerely