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

Alexander Dyagilev alervdvcw at gmail.com
Thu Apr 18 06:21:22 CEST 2024


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/3c9aec2b/attachment.htm>


More information about the Interest mailing list