[Interest] QML Image size vs sourceSize strange things

Alexander Dyagilev alervdvcw at gmail.com
Tue Mar 23 08:31:35 CET 2021


Hello,

We had a strange problem with blurred images under Retina displays. Left 
part of the image - before, right one - after the fix.

Our QML code was using with to show images:

Image{

anchors.verticalCenter:parent.verticalCenter

sourceSize.width:25

sourceSize.height:25

source:preview.url

}

I've tried to multiply sourceSize by Screen.devicePixelRatio - images 
became bigger so they did not fit their places.

Then I've replaced sourceSize.width with just width and the same for 
height. And it works fine now.

My questions is:

1) Is it required to multiply sourceSize by devicePixelRatio? Or is it 
managed automatically? It seems that it is managed automatically for PNG 
and NOT managed for SVG.

2) If it is already managed automatically for PNG (these images 
preview.url are PNGs) then why was it blurred? The original PNG image is 
of size 64x64 pixels under Retina displays.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210323/4ede0b52/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pjcgokflkeakcklh.png
Type: image/png
Size: 210193 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210323/4ede0b52/attachment-0001.png>


More information about the Interest mailing list