aboutsummaryrefslogtreecommitdiffstats
path: root/tools/svgtoqml/main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add asynchronousShapes option to QML generator, VectorImage and svgtoqmlEirik Aavitsland4 days1-0/+6
| | | | | | | | ...as well as to the cmake command to run svgtoqml at build time. Pick-to: 6.11 Change-Id: Ib9c2115f7ac34285cc5c9d67c64e2d2ebbcd738a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* svgtoqml: Fix running from packaged buildEskil Abrahamsen Blomfeldt5 days1-2/+0
| | | | | | | | | | | | | | | | | | In a packaged build, svgtoqml is placed next to a qt.conf file. This caused it to fail to launch from anywhere except in its local directory, with an error that it could not find the QPA plugin. It turns out that this was triggered by trying to query the available QPA plugins before creating a QGuiApplication. We did this to avoid forcing the minimal plugin if it is not available, but other tools that hardcode this plugin does it unconditionally, so we do the same in svgtoqml. Pick-to: 6.11 Task-number: QTBUG-142792 Change-Id: I2b7c0aa20c251a8fbf4f2372b8bc5e0802e298b2 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix svgtoqml invocation when there is no windowing systemEskil Abrahamsen Blomfeldt2025-10-161-12/+16
| | | | | | | | | | | | | | | | | | | | | | | Amends 641883c7e19b618ee47f0f7988bb161dc1056ae2. This change fixed an issue when cross-compiling and a platform plugin is not available. It selects the offscreen plugin when this case is detected, but uses the default platform plugin otherwise, since the offscreen plugin has limited support for fonts so we do not want it as the default. However, this did not fix the case where the platform plugin exists but there is no windowing system, e.g. when building over SSH. Luckily, the minimal QPA plugin does have proper font support and also works over SSH. We can therefore use this as the default as long as it exists. The only exception is if we need GUI to preview the result (if -v is specified or if there is no output file.) Task-number: QTBUG-140675 Change-Id: I967c8649be070c7ffc6541d033603c8e0e5c6eae Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* svgtoqml: Don't output full file path in commentEskil Abrahamsen Blomfeldt2025-09-111-1/+3
| | | | | | | | | | | | | | As part of the comment generated by svgtoqml, we would include the entire file path as it was provided in the arguments. With the introduction of the automatic svgtoqml build step, this argument will now include the full absolute path. Since the QML file is embedded in the binary, this caused internal file paths from our build farm to leak into the binaries, triggering an alert in the QA system. Change-Id: Iecffb5cfcf1cee127186b2c5d2e21e2ccc47f48a Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
* Make svgtoqml run correctly even without default platform pluginEskil Abrahamsen Blomfeldt2025-09-111-10/+11
| | | | | | | | | | | | | | | The Qt SVG parser depends on having a QGuiApplication in order to load e.g. fonts. We want to prefer the default plugin on desktop platforms, since you will then be able to use SVGs that depend on system fonts as well. However, in a host build, where there are no GUI-enabled QPA plugins, we fall back to offscreen, which has some font support but which does not depend on a window manager. Task-number: QTBUG-139976 Change-Id: Ia9a5239c3d16f1daa4ad68d66412f519109361c2 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add assumeTrustedSource property to VectorImageEskil Abrahamsen Blomfeldt2025-05-301-0/+7
| | | | | | | | | Certain checks and restrictions are in effect by default on the SVG parser. This introduces a way for disabling these in the VectorImage, when it is used with trusted content. Change-Id: I7a11c7276a01ae9eb128ed0afb2a04c38fe90c7a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Implement item generator via QML generatorEskil Abrahamsen Blomfeldt2025-04-111-1/+1
| | | | | | | | | | | | | | | | | We were spending time doing the same implementation twice, since the item generator and QML generator were two separate code paths. We also risked having bugs which only occurred in one of the code paths. This may at some point be a valid optimization, but during development it is premature. The parsing of the QML is a one-time cost when loading the SVG and this is an acceptable cost for now. Optimizations can come later when we have a more stable state. Fixes: QTBUG-135269 Change-Id: I649a89d7a2e18ef1c0213658dc106f2cc1194841 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Decouple the Quick vector graphics generator from qtsvgEirik Aavitsland2024-11-141-1/+1
| | | | | | | | | | | To allow other usages of QQuickGenerator and related classes, remove (most of) the hardcoding against qtsvg and restructure the api a bit. As a driveby, also ensure that all members in the generator's NodeInfo structs are initialized by default. Change-Id: I731a99422ff03ec7bd0301b124e3b3264c6cc0b7 Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
* svgtoqml tool: Improve options order, remove tech preview noteEirik Aavitsland2024-08-281-16/+16
| | | | | | | | | | - Remove tech preview note in help - Add single-letter shorthands for some more common options - Rearrange order options for increased clarity in help Pick-to: 6.8 Change-Id: Ibada4e59357f0c15772375336a8445fb664f7ee3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* svgtoqml: add a few minor usability improvementsEirik Aavitsland2024-06-171-6/+6
| | | | | | | | | | | | 1) Implement & document that if an output file is not given, the tool behaves as if the --view option was given. 2) If reading or parsing the input file fails, then avoid creating an empty output file. Also, let the tool exit with an error code. Pick-to: 6.8 Change-Id: Iaeb8cbb61c2c485cfa3ecba0d3193ba7cd4e5b87 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* doc: Flesh out svgtoqml documentationEskil Abrahamsen Blomfeldt2024-05-071-1/+1
| | | | | | | | | This adds proper documentation for svgtoqml and essentially takes it out of tech preview. Fixes: QTBUG-122695 Change-Id: I2b72e9189a9aabb65d9dc7162ac5a643695ad7a8 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* More options for embedded images in QML generatorEskil Abrahamsen Blomfeldt2024-05-061-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds a few options to the svgtoqml generator, to enable more control over how embedded images are stored. It adds the "keep-asset-paths" option. When this is set, the generator will check if an image reference was originally to a file on disk. Instead of duplicating this, the output will contain a relative reference to the original file instead. It adds the "asset-output-prefix" which overrides the default prefix of output files. And it adds the "asset-output-directory" which overrides the default target directory. The default target directory has also been changed to match the directory of the output QML instead of always saving to the currently active directory. In addition, this change makes the tool always output PNG files, since JPEG is a lossy format and should never be preferred. Previously, PNG was only preferred when the image had an alpha channel. Change-Id: I9a9b03eaea3ac511419789cfc5651d398ce42a5b Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Correct license for tools filesLucie Gérard2024-02-291-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tools file should be LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I109277d926cb95d45306fd0fe176451baee201cc Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* QQuickVectorImage: Refactor to new module nameHatem ElKharashy2024-02-131-8/+8
| | | | | | | | Refactoring QQuickVectorGraphics module to QQuickVectorImage which is better at explaining what this module does. Change-Id: Icdb6498e23355e6db3addb926847f8319c9d56e0 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Refactor svgtoqml toolHatem ElKharashy2024-02-031-20/+36
| | | | | | | | | | | | | | | | Move the generation part of the tool to a separate private module, which can generate either a QML file or a QQuickItem representation of an SVG File. The generator relies mainly on QtQuickShapes for rendering, in addition to using other QQuickItems. The generator in this module can be used by 'svgtoqml' tool. The plan succeeding this commit will be to add a QML module that will expose a QML component for loading an SVG file at runtime. Task-number: QTBUG-121659 Change-Id: I4014eb696a7d39f05f8b3035bdcee50d2acaf2b6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Preprocess paths in svgtoqmlPaul Olav Tvete2024-01-231-18/+26
| | | | | | | | | | | | Add --optimize-paths option to do expensive path manipulation at build time instead of at runtime. This may cause the generation of separate fill and stroke versions of the same source path. Task-number: QTBUG-116883 Task-number: QTBUG-121203 Pick-to: 6.7 Change-Id: Iacda16d8dbddf5b8219c290fac473d78c073576e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Add tool for converting SVG to QML using ShapesPaul Olav Tvete2023-11-241-0/+89
This tool is in tech preview. Only a subset of SVG Tiny works at the moment. The tool does not even support everything that QtSvg supports. Task-number: QTBUG-116883 Change-Id: Ie33f8bf42a5d37b63b86f6816df21960a1ef1071 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>