If we use the stored type, we lose important information.
Change-Id: I09264642cee8da2bd9103d01488855ebbc5648b5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Do not rely on QLoggingCategory being implicitly declared through
other headers.
Pick-to: 6.2
Change-Id: Ib6cda43f281d31a7127dd591be2540fb00a0a699
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
The so-far strategy is the following:
* allocate a linear storage for the QObject pointers
using QQmltcObjectCreationBase (to reference the
to-be-created objects)
* "type-erase" the QQmltcObjectCreationBase into
QQmltcObjectCreationHelper (so now we don't need to
know the template specialization across different
QML documents): non-document roots' ctors can accept
QQmltcObjectCreationHelper as an input parameter
* use QQmltcObjectCreationHelper to set object pointers
into the storage when creating all the objects (also
from other QML documents)
* use QQmltcObjectCreationHelper later to retrieve
necessary objects during creation finalization
Provide basic implementation for the first and second bullets
straight away
This model seems to allow to hide the details of QQmltcObjectCreationBase
interaction within the QML top-level document root (the type that we
instantiate in the user code), which is very convenient
Task-number: QTBUG-84368
Change-Id: I04cf64c54e48f169acfd4337cf93a58a05336b3b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We need this to be able to properly include types, properties, etc.
The strategy right now is very exhaustive but it seems necessary (afair)
to be able to support weird cases with non-trivial forward declarations
As a drive-by, fix some mistakes in QQmlJSScopeVisitor and its qmltc's
counterpart
Task-number: QTBUG-84368
Change-Id: I97719222598af85886821c0bf6e0e788770c8924
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
qmllint wants only the parenting. It should still warn about shadowing
(once it can).
Change-Id: If49a11cd086643f9626754fdeaaf6a9a7c1bc626
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Building them using ninja is pointless because they can't deployed /
executed without the Xcode generator.
Apart from that, the qml app will also fail to link in a static
top-level build with
Undefined symbols for architecture arm64:
"_qt_main_wrapper", referenced from:
implicit entry/start for main executable
due to QTBUG-98058. The linking failure does not happen in CI because
it does per-repo builds and not top-level builds.
Amends 3e2a85384b
Pick-to: 6.2
Fixes: QTBUG-98015
Task-number: QTBUG-98058
Change-Id: I7fe6538ac0e2f2ea0f89b09bb1b77265a3cd51fe
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
With the new CMake module API, we often have both the source and the
binary dir as an import path, with the qmldir only being available in
the binary directory. For deployment to work correctly, we need to pick
up the qmldir. Thus, when finding a module both with and without a
qmldir in different paths, prefer the version with the qmldir.
Pick-to: 6.2
Change-Id: I12efeae321da60b1b5ffe5c6d950ba486887ceb1
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Allow to opt out of package version checks by configuring
with -DQT_NO_PACKAGE_VERSION_CHECK=TRUE.
Pick-to: 6.2
Fixes: QTBUG-96458
Change-Id: Ibcba9a6b74ba770cb2fc949603eed275d47e55dd
Reviewed-by: Craig Scott <craig.scott@qt.io>
Previously some settings were only checked before any settings file
could be loaded, thus resulting in misapplied settings.
Now every settings option will be applied on a per-file basis as it
should be.
Pick-to: 6.2
Change-Id: Ib7c8a8d7dbec2d4379f634488e3899e1746c0c51
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Previously builtins not being found would lead to an endless loop that
crashes qmllint. Now missing builtins are handled gracefully,
aborting linting without crashing as this an unrecoverable error.
Change-Id: Ia585b1e0e5c972dad0eeabf8df06edf71eaea0c7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Use generalized grouped properties rather than the target/property
syntax.
Change-Id: I2cf42fa7933d67aa40ded5ffd00be51be8f9b7c2
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Implements controlling qmlformat via a settings file as can be done for qmllint.
[ChangeLog][General][qmlformat] Adds the ability to set linting options
via a settings file rather than using command line parameters. Use
--write-defaults to generate a template with default values for editing.
Use --ignore-settings to disable this feature.
Fixes: QTBUG-86415
Change-Id: I282c3b994ca6cc491a27b45f531f1ba1c2652ef7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Output primitives have "scope" classes to control the way the output is
written/recorded. Those classes have ctor/dtor but lack other special
member functions, so fix that by delete'ing those - we don't need to
copy or move the objects of these classes anyway
Change-Id: Ia555aaff085a8a7a0182a2c9a2228949bfd7a940
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
- Finish output ir and the writer for it
- Add simple compiler logic to generate dull class declarations
Task-number: QTBUG-84368
Change-Id: I75be0f44b84ad3cfb1d862072d58b3bf87063d31
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Also update tests to include the generated file. While the
content is meaningless, it's good enough to check that the file
is include-able at this stage
Task-number: QTBUG-84368
Task-number: QTBUG-96040
Change-Id: I155826a52090c5b13d14be6330813dc5a27f28e5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This is a stub commit that introduces qmltc as a binary
We don't even attempt to generate any code here yet
Task-number: QTBUG-84368
Change-Id: I98da17d839970a2561f501f3b9d6b1e1310e0e01
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
When a Connections component is the root component, we are unable to find a parent component which used to lead to a crash.
This change fixes this issue. While this usage cannot be analyzed by qmllint at the moment it should at the very least not lead to a crash.
Fixes: QTBUG-97600
Pick-to: 6.2
Change-Id: If831d9c5ec822693896d48d65689d12628a6690e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Call qt_internal_return_unless_building_tools() directly after
qt_internal_add_tool() to avoid having to special-case code for when
this function only creates imported targets in cross-builds.
Task-number: QTBUG-85084
Change-Id: I5c8f2ecdf4936cfd15cb530e896bc4e5b5531620
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Before, they were tools, which means they are not built when
cross-compiling. However, all these tools are likely to be desired on a
target to run QML-only projects.
The earlier way to build these apps for a cross target was to set
QT_BUILD_TOOLS_WHEN_CROSSCOMPILING to ON. That seems like overkill.
Pick-to: 6.2
Task-number: QTBUG-96454
Change-Id: Ibbdc4e4599b0c798ddbd96804a0bbb821f546415
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Addressses reported in tools and libraries of qtdeclarative (including
qqc2).
Task-number: QTBUG-97092
Change-Id: Ice5bcdd4e4f20a28716a1e339bb0f033b3e5a7f2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This gives us type information for a few extra properties, among which
is ArrayBuffer. We also declare ArrayBuffer as extension to QByteArray,
which we can now test with qmllint.
Change-Id: Ibb3da5e8b8a9e839dc6365fbeabe8418022d1346
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Methods on the "Math" object preferably deal with numbers, and if we
pass them numbers, they also return numbers. Model this as overrides of
the generic methods.
Change-Id: I419093630577c371846e5c8ac153f90ed6ffa87e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It was used to determine visibility of messages in the compiler
category, but that category is off by default anyway. If it is on, we
indeed want to see all the messages.
Change-Id: I8b647d0df2c43c3a04235f7b77e7111ea3cb0f31
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We want it to be mutable even where Codegen itself is const. Therefore,
it needs to live outside Codegen.
Change-Id: Ie4997118a1fdf8d60bd5670baa506ed0bfb98bad
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
This is mostly useful as an replacement for Quick Controls' tst_sanity but might also be useful in some other instances.
Fixes: QTBUG-96572
Change-Id: I5cf414bfeb369cbc394563c5c5ed807599b09a2f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We need the file name in order to see when the file we're examining is a
qmltypes file.
Change-Id: I72b6c3fe63e721b2b2a116fcafcb55e45b23ae39
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
[ChangeLog][QtQml][qml] The QML Runtime tool's --dummy-data option
is now deprecated, because context properties are deprecated. This
option will be removed in a future version of Qt.
Task-number: QTBUG-96800
Change-Id: Id6ef8a384f6239ddeebd6c4f84854bbeaf630279
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Also, --list-conf will now list the conf files that it finds;
and --verbose will show more information about the path(s) to them.
[ChangeLog][QtQml][qml] The QML Runtime tool's -c / --config option
now can find a directory containing a file called configuration.qml
under QStandardPaths::AppConfigLocation, in addition to being able to
give the full path to the configuration file, as before. I.e. on
Linux you could write a custom configuration into
~/.config/QtProject/Qml Runtime/myconfig/configuration.qml
and then use it via qml -c myconfig somefile.qml. The --list-conf
option will list the configurations that can be found in this way.
Task-number: QTBUG-26366
Fixes: QTBUG-96740
Change-Id: I72798b22255b71b9d4184a67f86b249766b64233
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This file is completely unused now but we forgot to remove it.
Change-Id: I653469be0bfc7ee9288f24d3120223b037b1169a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
UiObjectDefinitions with lower case names are not QML elements, but
grouped properties. Using this information, we can now properly warn
about invalid names for grouped properties.
Pick-to: 6.2
Fixes: QTBUG-96147
Change-Id: Ib02705b28f6324d0b98bb66c09cb4708c18943bd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Make the default dump more concise and useful:
* remove most large fields non related to the semantics (comments,
file location, exports, pre/postCode,...)
* allow empty (catch all) filter
* call filter.setFiltred() to correctly filter custom filters
* dump the loaded files, and not the whole environment (unless
requested with --path-to-dump $env)
* do not load dependencies by default
Change-Id: I5d26dc074bc0cbace31508401e9d08d90c99a254
Pick-to: 6.2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If filetype is given use it to specify the type of the file to
load (otherwise guess it from the file extension).
Can be used to load qmltypes files as "plain" qml files (for
reformatting).
Ths enables the reformatting of .qmltypes (for API comparison)
Change-Id: Ib65647c2a8dc8b37b7e955acb3aec2193d36666d
Pick-to: 6.2
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
read qmltypes files using the QmlCompiler provided reader
Change-Id: Ifb091a1d645e697cd3b648da96c69868f240d037
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This puts them right below the description of warning levels and hopefully makes the whole help easier to read.
Task-number: QTBUG-95971
Change-Id: Iff6062e700c2c277fc4c69a8130ba6b2dd5e35c0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The current code assumes that the basename of the QML plugin is the
same as the CMake target it corresponds to. This won't be the case for
installed Qt packages due to the installed name including a namespace.
It also won't match when a Qt library infix is used. The current code
works around the former by trying to heuristically work out whether
a namespaced Qt target exists for the plugin. The Qt library infix is
more problematic because the plugin target name won't include the
infix whereas the plugin library basename will.
Address both of those issues by adding an internal option
INSTALLED_PLUGIN_TARGET to qt6_add_qml_module() which allows the
installed target name to be provided. When included in a qmldir file,
qt6_import_qml_plugin() will use that name, otherwise it will fall
back to using the plugin library's basename, as per the current
behavior. The option may become public in the future, but for now it
is only for Qt's internal use for the 6.2 release.
Fixes: QTBUG-95140
Pick-to: 6.2
Change-Id: I5a057c80b70ee802c0f0840e9eea2e579193d126
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QQmlImportVisitor was accepting ctor paratemeters for the QQmlJSLogger,
creating own logger internally. This seems wrong since in that case we
kind of have separate logger for visitor and type resolver (among other
entities)
On top of this, the import visitor had a silent logging by default
(and the QQmlJSLogger is not silent on the contrary) which in fact hid
some issues that should've been reported by qmllint (but they weren't)
For consistency, the silent logger is still used. And the ultimate fix
would be to use FindWarningsVisitor instead of QQmlJSImportVisitor
as currently we do 2 AST traversals in qmllint
Change-Id: I4c54b76d130e7e8f31c90a148edc1c02f7e86ab8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
While migrating to QQmlJSTypeResolver in qmltc, some minor things didn't
match exactly with the currently used type resolver. I'm not planning to
submit those things just yet so it's easier to just make the class
subclassable by making its members protected
On top of this, decouple the QQmlJSImportVisitor from the type resolver
to allow arbitrary visitor to be used for document traversal. This would
anyway be needed for qmltc later on (it seems) as several qmltc-specific
visitor passes are needed, yet they aren't that useful for e.g. qmllint
Change-Id: I9fabcf6c0f2119b0d064bb27157b7085275e7665
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Instead of std::exit() use the early return mechanism we already have so
that any existing objects are gracefully destroyed.
Change-Id: Icb197879cc33ab22f07fc1486da44f9ff5b177bc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Since all of the warnings have been moved out of checkidentifiers we can now simply remove it.
Change-Id: Ie59e306b69ca397c1e191a0fe379bc084f98cf73
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Another step to making checkidentifiers obsolete.
Change-Id: I14be7491387200101b66e0930faf16e9b61d4159
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Moves the last remaining warnings of checkidentifiers into the qmlcompiler.
Change-Id: I8e4330d3c054620463dc0462c272c3577fd10c8d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Also changes the error message to be a bit clearer about what went wrong and does not involve the unrelated follow up property not being able to be resolved.
Change-Id: I7071ca718b85d1282adacf40ba2bdc62fe5aad6d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>