[Interest] QML Image size vs sourceSize strange things

Jérôme Godbout godboutj at amotus.ca
Tue Mar 23 16:43:01 CET 2021


Yes good point, take care those built-in size attributes are optional, might not be there into an SVG, you might not want to count on it.

From: Interest <interest-bounces at qt-project.org> on behalf of Giuseppe D'Angelo via Interest <interest at qt-project.org>
Date: Tuesday, March 23, 2021 at 10:53 AM
To: interest at qt-project.org <interest at qt-project.org>
Subject: Re: [Interest] QML Image size vs sourceSize strange things
Il 23/03/21 14:16, Jérôme Godbout ha scritto:
> Do you really need to same memory by reducing the source size? I think
> you should left the source size alone and sample the image from the full
> source. Source size for SVG doesn’t make any sense, it’s vectoriel,
> doesn’t have any size, it can scale to any dimension.

This isn't accurate. SVG files have a builtin "wanted" size, which is
IIRC what Qt would use by default:

> https://www.w3.org/TR/SVG11/struct.html#SVGElementWidthAttribute

By explictly setting `sourceSize` you're asking Qt to rasterize the SVG
at a different resolution rather than the wanted one (and downscaling
when rendering).


My 2 c,
--
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210323/99a82f4c/attachment.html>


More information about the Interest mailing list