fix(StatusRoundedImage): actual loaded image width and height updated

In case you're dynamically change source image and image width and height
are way bigger than the rounded image component width and height, resizing
was not done correctly.

update

update
This commit is contained in:
Sale Djenic 2022-05-30 10:46:38 +02:00 committed by Michał Cieślak
parent 99f1634fbc
commit 76a0caaa13
1 changed files with 11 additions and 3 deletions

View File

@ -28,11 +28,19 @@ Rectangle {
id: image
width: statusRoundImage.width
height: statusRoundImage.height
sourceSize.width: parent.width * 2
sourceSize.height: parent.height * 2
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
cache: true
onSourceChanged: {
if (sourceSize.width < width || sourceSize.height < height) {
sourceSize = Qt.binding(function() {
return Qt.size(width * 2, height * 2)
})
}
else {
sourceSize = undefined
}
}
}
Loader {