There is no security critic code in qmlformat. Everything remains
at the default "signicant" security level.
QUIP: 23
Fixes: QTBUG-136198
Pick-to: 6.10 6.9 6.8
Change-Id: Iac1c84748bc98a9c921fc8ae895a2dcd53d01270
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
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>
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>
"valueType" is ambiguous. The prevailing meaning is a type that's passed
by value in QML. We mean the type of the list contents (or elements)
here.
Change-Id: Iaf4c0efe272dc6ec7511d2361e7e5ce475936fba
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Don't search for heuristic context properties in qmllint, to avoid
making qmllint more complicated from a user perspective. Instead,
qmlcontextpropertydump can be used via its CMake target.
Task-number: QTBUG-128232
Change-Id: Ie7553821e6b62c0a89179e8abee2ac7d15647265
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
It fails in a no-prefix per-repo build of qtdeclarative standalone
examples build, with the following error:
ninja: error:
'examples/quick/quickshapes/weatherforecast/Qt6::svgtoqml', needed by
'examples/quick/quickshapes/weatherforecast/.qt/svgtoqml/Europe_generated.qml',
missing and no known rule to make it
Wrap the command in a <TARGET_FILE> genex, and prepend the tool
wrapper shell script for Windows hosts.
Amends 018b10ff71
Change-Id: Ib4aa91f3680cad40ac462a48b09a4acf795ff7ae
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Add a tool that runs the heuristic for context properties and dumps the
.ini generated by the heuristic search, for future calls of qmllint.
Add a test.
Task-number: QTBUG-128232
Change-Id: I5d03db45f41ef90c6f5d931837aaa466abc33303
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Hints are no longer their own fix suggestion but instead are part of an
existing one. This breaks compatibility with the existing format but as
the output is not documented and is versioned this should be ok.
This change will enable having multiple fix suggestions per warning in a
future change.
Pick-to: 6.10
Change-Id: Iedf275507554a2d70399757396e278999874cd53
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Add reportConfigForFiles to generic tooling class. It will perform the
search for the given files. Use stdout to report. qmllint had already an
option --dry-run for printing the fixed codes, but we can still allow this to
use that option name.
For qmlls, report the path if verbose option is set.
Fixes: QTBUG-137874
Change-Id: I6bd43866073b3df832b6fd89d477bced869d74c0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This adds a build command for generating QML files out of SVG
files automatically. It works by first calling svgtoqml on the
sources and then adding these to the QML module for the target.
[ChangeLog][svgtoqml] Added a cmake api for automatically
generating QML files from SVG files in an application.
Task-number: QTBUG-128915
Change-Id: I44e70f0ada4ca8ac9ac8253d46832d3a286da927
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Prepares for QTBUG-138061 where we need a way to load user-defined
context properties into QQmlJS::ContextProperties.
Rename QQmlJS::ContextProperties into HeuristicContextProperties to
avoid confusions with the UserContextProperties.
Make HeuristicContextProperties a real class so that we can add methods
to load and save context properties to and from disk.
Make the heuristics be saved in a list instead of a QHash, as the order
of the property matters as we write them out into a file and testing
becomes complicated when the order changes between different runs. Also
note that it might be confusing for qmlls users if their warnings change
orders during multiple runs.
Rename some methods for clarity.
Task-number: QTBUG-138061
Task-number: QTBUG-128232
Change-Id: Ib6302f609e182e622015293366c8b42425566a0e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In QML, one can use XMLHttpRequest. Not so with a plain JS engine. The
reason for that lies in the fact that a JS engine did not have any
network access, because all network functionality was in the type
loader, and the type loader was coupled to the QV4::Engine.
This has changed in d2bc4a4330, but we
stil don't expose XMLHttpRequest to a plain QJSEngine.
Nevertheless, it conceptually lives in the global object, and we need to
collect information about it to enable code completion and linting.
Consequently, expose a function in QV4::Engine, which allows us to
manually trigger the registration, and call it in qmljsrootgen.
Going forward, we should arguably have a QJSEngine::Extension for
XMLHttpReuqest, after which we could remove the hack.
Note that as before, qmljsrootgen prints a few warnings, because we call
functions in contexts in which they must not be called. As before, we
ignore this for now.
As a side-effect, this adds a few more entries to the qmltypes file for
new entries on the global Qt object.
Task-number: QTBUG-137075
Pick-to: 6.10
Change-Id: I21e9d62bf075e8d4356db8f357502feb927717e7
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
This is not needed by our own tooling, and in the case of major version
only imports might lead to funny results.
It is however used by Linux distro tooling, and can't cause issuse with
older QML projects that never used the more advanced import features.
The feature is only enabled when the add-version flag is passed, as we
don't want to risk confusing our own tooling which might not expect the
value to exist.
Amends 6aa4c83bdb
Note that we need to adjust the rootPath.json file, as the new file
causes us to find more modules.
Pick-to: 6.10
Fixes: QTBUG-115170
Change-Id: I20d39dacc87f18fc5bbec93aaec5bdaef0c77c4b
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
We need to get rid of it. Use the type loader instead.
Change-Id: I63be8eab38401feed4e6461b03804e8335f41899
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
The qmltestrunner binary needs to be available as a CMake target, so
that a $<TARGET_FILE:...> genex can work. KDE projects use such a
genex to run their qml tests.
For Windows on ARM, when it is cross-compiled from an x86 Windows
host, we need the binary to match the target platform and arch, to be
able to run the tests.
To achieve both use cases, change the binary back from an app to
a tool to make it available as a target automatically when
calling find_package(Qt6Qml).
To ensure the binary is also cross-built for the target arch when
cross-compiling, set QT_WILL_BUILD_TOOLS and
QT_WILL_RENAME_TOOL_TARGETS to ON locally in the subdirectory.
Add an opt out not to build the target binary (by skipping the local
QT_WILL_BUILD_TOOLS assignment) if QT_NO_TARGET_QMLTESTRUNNER is set.
This won't affect regular yocto builds that set QT_FORCE_BUILD_TOOLS
to ON, so that will work as usual.
This is a temporary workaround, until we can create some kind of
QtFooAppsConfig.cmake file which would expose the binary as an app
target, rather than a tool target, like we currently do for tools.
Amends 722116b32a
Pick-to: 6.10
Task-number: COIN-1211
Fixes: QTBUG-137005
Change-Id: I9b5a59f5bd30c2e30e5578354515e018383f2926
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
... rather than QQmlEngine. This paves the way for having the type
loader attached to ExecutionEngine rather than QQmlEngine.
Also, reference the execution engine in the type loader, in turn.
Task-number: QTBUG-19407
Change-Id: I04e571c5c6ac5bce5e82537cb96c6940c7186f3a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Make members private, add accessors, add m_ to member names, etc.
Change-Id: I497db10b62bbfb32f55dca227af9a518da6eaa70
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
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>
Warn in QQmlJSTypePropagator::generate_LoadQmlContextPropertyLookup()
about usages of context properties that were found. Also treat context
properties as var.
Add the (C++) location of the "setContextProperty()" call to the
warning, and also hint that a property is assumed to be a context
property when inside a top-level component (capital C Component, inline
component or implicitly wrapped as component) because it is not
declared as required property.
Still print the accompanying unqualified warnings next to the new
context property warning.
Add a test.
Later patches will add the support to qmlls and qmllint by passing
the workspace folders to the new functionality.
Task-number: QTBUG-128232
Change-Id: I26e39e0bce8c6e9f203962a091209c7acd15d445
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
A top-level configuration with FEATURE_thread=OFF fails when autotests
are enabled. Most tools can be built without threads nowadays, so we
enable them and only exclude the qquickworkerscript and gifs tests.
Pick-to: 6.8 6.9
Change-Id: I809b021b4bdc4031d6c3335bea3aee414f5ce863
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Change arch build type of qmltestrunner to match the target
and not host.
This amends 3e2a85384b.
Task-number: COIN-1211
Change-Id: I4cac9d0d664ea14bd95cea10936d790ab1d33d4a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The argument "-a" passed after "--" was being interpreted as the -a
option of the qml tool itself instead of being passed along to the qml
program as a positional argument.
Fixes: QTBUG-136120
Pick-to: 6.9 6.8 6.5
Change-Id: I602aea84e4766abeb47adce0f739f12315a70b24
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Add a command line parameter to print the qmlls version, required by
qmlls clients to check the version of downloaded qmlls binaries.
Fixes: QTBUG-132692
Change-Id: I7903f6859b6da2f3849a899e46fe4c5ce1cf4c42
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Process all properties of custom parsed types and generate errors if the
custom parsed properties are actually used. Then print an extra error
stating that qmltc does not support custom parsers.
Pick-to: 6.9 6.8
Fixes: QTBUG-134206
Change-Id: I37e4f3f8d0ee4e0926c0d64c99a4a521b093a1ab
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
QPair is just an alias of std::pair anyway.
Task-number: QTBUG-115841
Change-Id: I26fc90adcc775aac9955ad57304af914dc4ed48f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We have QQmlJSUtils::toLiteral() for that. Extend it to handle byte
arrays in addition to strings and use it.
Fixes: QTBUG-134726
Change-Id: Ibde1f56b25794fc8c49b796303c4f39933aedb42
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
We don't want to export those symbols from QtQml. Move the code that's
exclusive to the debug service into the debug service and the code
exclusive to qmltc into qmltc. The remaining code can be inline.
Change-Id: Icf146af8d4e5931b7ac7bac61a5ba94449ca9402
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
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>
Some clang toolchains use implicit adhoc codesigning when compiling
and linking executables. This causes an error for the qmltestrunner
codesign call, saying that the executable is already signed.
Force the codesign command to override the existing signature in that
case. This is safe, because we build the executable from scratch.
Amends 1f7b87cd3d
Pick-to: 6.8 6.9
Fixes: QTBUG-135279
Change-Id: I0e0a989eb018c75ad1463700782bef9c7b999fa0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Make sure both have their own setting key, but still support the
previous "buggy" setting key. Print a deprecated warning when finding
the buggy setting key in a setting file.
Task-number: QTBUG-135020
Change-Id: I364e7e41380de43a0883bcf4d3f6cefcf11b6c90
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Use join's before parameter to only add the foreign-types parameter
to the command invocation if there is actually a list of foreign-types
to handle.
This avoids "cannot open foreign types file" warnings during the build
process.
Pick-to: 6.9 6.8
Change-Id: I142d0fab44201a3314354173ea30d2f90841a6f4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
While those properties may be of type Component, they don't have to. We
can in fact not resolve anything resembling an ID while inside one of
those objects because we cannot determine the component boundaries.
Amends commit dea8e38d95
Pick-to: 6.9 6.8
Fixes: QTBUG-133460
Change-Id: Iac7294166d38ce591c45c0d31b139a52eda70fc1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Due to unknown reasons, if the qml_tool target links twice to
the Qt6::Qml target, the qml_tool_autogen target loses almost all
dependencies on other autogen and sync_headers targets, but most
importantly on Qml_sync_headers.
This can cause bad race conditions during the build.
Apply a hacky workaround of removing the duplicate linking to Qt6::Qml
which appears to resolve the issue, and brings back the correct
dependency.
This might be an issue in upstream CMake, but requires further
investigation.
This change is meant to unblock merges to qtdeclarative.
Pick-to: 6.8 6.9
Task-number: QTBUG-133725
Change-Id: Ib6b41d36a19f5d9e1c9fa96aabfbc00f5870990f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
We are sporadically seeing weird failures on macOs that the types from
the module are not available. This could not be reproduced reliably, but
we suspect that the linker might discard the (static ctor invoking the)
registration function.
Avoid this by calling it explictily.
Change-Id: Ic405dd5f226af3580efe7dd5d8202a6a263a367e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
...Then we can add tests for them. More tests to be added in the next
commit.
Pick-to: 6.8 6.9
Task-number: QTBUG-133225
Change-Id: I3f40ddc3d0895a785d6bce359c63ad6ad4d70606
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
We no longer have Options{} data structure. Use QQmlFormatOptions
instead.
Pick-to: 6.8 6.9
Task-number: QTBUG-133225
Change-Id: I0a3625a4e41948c4fd010a52d71b8c5fb352ba82
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Move the tool's code to the library and make qmllanguageservertool.cpp
as small as possible. Fix the strings to have _L1 to avoid warnings.
This would allow to have a duplicate version of
qmllanguageservertool.cpp outside of qtdeclarative, which then could be
statically linked to the help plugin in qttools. This would enable the
documentation support in the standalone qmlls build (which currently
can't provide any documentation hints).
Task-number: QTBUG-132773
Change-Id: Ia1717c0f71f70f6bb5d863017fe050117688d9e7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Certain compile passes may be run multiple times and only the last run
counts. We need to be able to roll back the logger to the state before
the pass in that case.
Amends commit d70abd83dc
Pick-to: 6.9
Task-number: QTBUG-124913
Change-Id: Ie6174fc3d6ce60ca3f0a3fa27484a58e6febcc17
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Swift 5.9 includes built in crash reporting, printing stack traces,
libraries, and registers to stdout/err.
https://www.swift.org/blog/swift-5.9-backtraces/
As (Core)Foundation is written in Swift nowadays, we get this feature
for free even in our "C++" apps, as we always link to CoreFoundation.
To enable the feature the binary needs the com.apple.security.get-task-allow
entitlement, so we add it for qmltestrunner.
Pick-to: 6.9 6.8
Change-Id: I31090efee06460f45522093e17f900e76590b282
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We currently have two orderings for the READ and WRITE elements of the
macro depending on whether we compile a property or an alias. Make them
uniform by having READ before WRITE in both cases.
Change-Id: I1dd308c921b8948347029c603bc3bca2be87abda
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reorder imports alphabetically.
[ChangeLog][qmlformat] qmlformat now supports sorting of imports,
there is a new commandline option -S that is used to sort imports.
Fixes: QTBUG-132061
Change-Id: Ic163456d2beed84833f7aadef0688d37292ef0f2
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
We don't need m_valid to check if there is an error. Do validity check
by m_error.isEmpty().
Prior to this commit, an invalid command line option given to qmlformat
wouldn't spit out the error message and qmlformat would silently ignore
the error and run with default settings. For example, the command
qmlformat -W -342523 <filepath> should error out with this commit since
a negative line length is given.
Change-Id: Ie7d07e3b2b3714793f9abed4558003cc5ad77b34
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
In cross-builds of Qt we missed to install qtquickcompiler.prf and
qmlcache.prf. Fix that by installing these files before the
qt_internal_return_unless_building_tools call.
Remove qmake2cmake conversion cruft as drive-by.
Fixes: QTBUG-132423
Pick-to: 6.5 6.8 6.9
Change-Id: Ic7a63af90985e42c221cce2c54de285f03b09999
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This works by first creating a transform object per animated
property we have in SVG. Then it creates a set of key frames
based on these. All key frames will touch all animations, so
that they can also control activating and deactivating an
animation, freezing the end result of one, etc. The frames
we generate are based on the end points of animations as well
as right after (and sometimes right before) the animation to
record the state when it is inactive.
If any of the animations have infinite repeats, we create a
set of key frames for the finite part first and then the
infinite loop, so that these are separated into two different
animations in QML.
At each key frame we check all animations to see if they
affect their corresponding transform at this time. If they
are inactive, the transform will be set to a default value.
But if they are active (either running or frozen), we
query the interpolated value from the animator to get the
value at the specific time.
Pick-to: 6.9
Fixes: QTBUG-127590
Change-Id: I0102cefb3713a0c36661fb3da008b25b19a80427
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>