[Interest] SVG is loaded with invalid dimensions on some machines

Alexander Dyagilev alervdvcw at gmail.com
Thu Apr 18 16:52:23 CEST 2024


Hello,

The user with the issue has two monitors connected to his PC. *Weird thing*
is that SVG is loaded properly on one monitor (2K) and improperly on
another one (FullHD). How can this be? Only Qt authors can probably shed
some light on this issue :)


On Thu, Apr 18, 2024 at 11:24 AM Alexander Dyagilev <alervdvcw at gmail.com>
wrote:

> Image as it's displayed on the user's machine:
>
> [image: image.png]
>
>
> On Thu, Apr 18, 2024 at 11:21 AM Alexander Dyagilev <alervdvcw at gmail.com>
> wrote:
>
>> I forgot to mention that this happens at least with Qt 6.4.3 and 6.6.2
>> (or 6.6.3 I don't remember exactly). We use this code to load the image:
>>
>> import QtQuick 2.12
>>
>> Image
>> {
>>     property double zoom: 1.0
>>
>>     readonly property int preferredWidth: sameHiddenImg.implicitWidth *
>> zoom
>>     readonly property int preferredHeight: sameHiddenImg.implicitHeight *
>> zoom
>>
>>     // it works buggy under e.g. Retina displays without this
>>     width: preferredWidth
>>     height: preferredHeight
>>
>>     // it works buggy under e.g. Retina displays without this
>>     sourceSize: Qt.size(width, height)
>>
>>     Image
>>     {
>>         id: sameHiddenImg
>>         visible: false
>>         source: parent.source
>>     }
>> }
>>
>> So, valid values for preferredWidth and preferredHeight are 93 and 456.
>> But for some rare users they are 116 and 570 accordingly.
>>
>> On Thu, Apr 18, 2024 at 11:16 AM Alexander Dyagilev <alervdvcw at gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> A few of our users have issues with UI rendering. We SVG sprite to
>>> display some elements of our UI. This SVG has a size specified in it
>>> (93x456). And of course we rely on it. The issue is that sometimes it's
>>> loaded with 116x570 size due to some unknown reason. So it's like a
>>> different image and we can't use such a sprite properly anymore.
>>>
>>> What can be the cause of that? I've attached this sprite image.
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240418/c046917d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 38585 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240418/c046917d/attachment.png>


More information about the Interest mailing list