VectorImage QML Type

Loads a vector image file and displays it in a Qt Quick scene. More...

Import Statement: import QtQuick.VectorImage
Since: Qt 6.8
Inherits:

Item

Properties

Detailed Description

The VectorImage can be used to load a vector image file and display this as an item in a Qt Quick scene. It currently supports the SVG file format.

Note: This complements the approach of loading the vector image file through an Image element: Image creates a raster version of the image at the requested size. VectorImage builds a Qt Quick scene that represents the image. This means the resulting item can be scaled and rotated without losing quality, and it will typically consume less memory than the rasterized version.

Property Documentation

fillMode : enumeration

This property defines what happens if the width and height of the VectorImage differs from the implicit size of its contents.

ConstantDescription
VectorImage.NoResizeThe contents are still rendered at the size provided by the input.
VectorImage.StretchThe contents are scaled to match the width and height of the VectorImage. (This is the default.)
VectorImage.PreserveAspectFitThe contents are scaled to fit inside the bounds of the VectorImage, while preserving aspect ratio. The actual bounding rect of the contents will sometimes be smaller than the VectorImage item.
VectorImage.PreserveAspectCropThe contents are scaled to fill the VectorImage item, while preserving the aspect ratio. The actual bounds of the contents will sometimes be larger than the VectorImage item.

preferredRendererType : enumeration

Requests a specific backend to use for rendering shapes in the VectorImage.

ConstantDescription
VectorImage.GeometryRendererEquivalent to Shape.GeometryRenderer. This backend flattens curves and triangulates the result. It will give aliased results unless multi-sampling is enabled, and curve flattening may be visible when the item is scaled.
VectorImage.CurveRendererEquivalent to Shape.CurveRenderer. With this backend, curves are rendered on the GPU and anti-aliasing is built in. Will typically give better visual results, but at some extra cost to performance.

The default is VectorImage.GeometryRenderer.


source : url

This property holds the URL of the vector image file to load.

VectorImage currently only supports the SVG file format.