Not scaling svg in Image
-
@odelaune It's not widgets. I use QML image and set source.
Image { id: imageMap source: "/path/to/file/or/data/from/file" anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter width: flickableMap.contentWidth * 0.2 height: flickableMap.contentHeight * 0.2 fillMode: Image.PreserveAspectFit
-
@Mihaill
There are two notable reasons why you may not choose to use an SVG file.
1. Not the right format for high-quality or detailed photos. Designers create vector graphics with points and paths, not pixels. ...
2. Requires some knowledge of code. SVG is an XML-based scene description language for graphics.I have a background image with a lot of machines and svg does not help in its display. Therefore, it was made to png.
-
I am not an expert in QML as I am always using QWidgets. Inside QWidgets you would use something like QPixmap or QImage. Both render the SVG file with a certain resolution and forget about the source. This is why it would also look pixelated using QWidgets. There, I would write code that reacts to the scaling and reloads the SVG every time to have the proper size (maybe a trick would be to load it with twice the pixelRatio and hope it looks fine when scaled like this).
I am not sure how (or if) this approach translates to QML. Can you react to the resizing in QML and then "change" the image to the same SVG file?
-
@SimonSchroeder updating image not help me, Image rendered svg with big pixels.
-