Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qt_target_qml_from_svg.qdoc
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qt_target_qml_from_svg.html
6\ingroup cmake-commands-qtquick
7
8\title qt_target_qml_from_svg
9\keyword qt6_target_qml_from_svg
10
11\summary {Generates QML code based on an SVG file.}
12
13The command is defined in the \c QuickTools component of the \c Qt6 package, which can
14be loaded like this:
15
16\badcode
17find_package(Qt6 REQUIRED COMPONENTS QuickTools)
18\endcode
19
20\cmakecommandsince 6.11
21
22\section1 Synopsis
23
24\badcode
25qt_target_qml_from_svg(target
26 [CURVE_RENDERER]
27 [OPTIMIZE_PATHS]
28 [OUTLINE_STROKE_MODE]
29 [TYPE_NAME "MyShapeName"]
30 [COPYRIGHT_STATEMENT "Copyright © Company1"]
31 FILES file1.svg [file2.svg ...]
32 OUTPUTS File1.qml [File2.qml ...]
33 )
34\endcode
35
36\versionlessCMakeCommandsNote qt6_target_qml_from_svg()
37
38Example:
39
40\snippet vectorimage/CMakeLists.txt svgtoqml
41
42\section1 Description
43
44qt_target_qml_from_svg() creates the build steps to run \l{svgtoqml} on the list of SVG images in
45\c FILES. The names of the generated files should be specified in \c OUTPUTS. The length of this
46list must be the same as \c FILES, and the first element corresponds to the first element in
47\c FILES and so forth. The names provided in \c OUTPUTS will be the names of the QML types as they
48appear in the module. These can in turn be instantiated in the application code.
49
50The generated QML files will be added to the QML module of \c{target}. You must use
51\l{qt_add_qml_module()} to define a module for the \c{target} first.
52
53Optionally, a \c COPYRIGHT_STATEMENT argument can be provided to insert copyright information
54into the generated files.
55
56\note Certain characters must be escaped for command line use or you may see build errors on
57some platforms.
58
59\c TYPE_NAME is also optional, and can be used to replace all instances of the \l{Shape} type in
60the generated file with a custom type. This can be useful to make general customizations to all
61the shapes in the provided SVG files. The \c{TYPE_NAME} should refer to a QML type which is
62available in the \c{target} QML module.
63
64The options \c CURVE_RENDERER, \c OPTIMIZE_PATHS and \c OUTLINE_STROKE_MODE correspond to the
65\c{--curve-renderer}, \c{--optimize-paths} and \c{--outline-stroke-mode} in \l{svgtoqml}
66respectively.
67*/