URLs with two slashes after the colon are generally _not_ local as they
contain an authority. However, file URLs with two slashes are
interpreted as "special" paths by QUrl::toLocalFile(). Therefore, we
accept them.
URLs without slashes after the colon can be local files. They denote
relative paths or special android resources then.
Pick-to: 6.2 6.3
Fixes: QTBUG-102944
Change-Id: Iaab3d7501b631e88ee8c1d93f1de8149ba60a5c4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
In JavaScript the [] operator on strings returns a string. QString's
operator[] returns a QChar, but we can easily create a string from that.
Fixes: QTBUG-103371
Change-Id: Id5c960f00ecc7a5dfe30ccbcaac3ffb2a30308b9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Instead of the storedType hack in the type resolver, properly declare
the type LoadElement can return: A merge of undefined and the actual
type. This way we can choose the best concrete type to use for this
independently (and optimize it later).
Task-number: QTBUG-103529
Change-Id: I17b1f835f6a893ec843a90491e92f72ecb2e87fe
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Previously we just crammed it all into one line.
This made debugging really painful. You either had to properly cut out
the source code, remove all the additional quoting and reformat it or
run qmllint manually to get proper formatted output.
This way you can actually debug these issues without resorting to any
external tools.
Change-Id: Iafdaaaa0ef7b96e70057b9b637b7c8f051d9e43a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
If components are bound we can assume the IDs of outer components are
reachable.
Fixes: QTBUG-102806
Fixes: QTBUG-101012
Change-Id: Ia26d3963d6c2fb9698debb12f9c655c5522f81ea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Clone the full-ish meta object hierarchy when dealing with extensions:
that way we guarantee that shadowing works correctly both ways -
extension properties can shadow type properties AND type properties
can shadow extension properties (the latter happens when extension
belongs to a base type). This was impossible before since we would
always put extension proxies on top of the meta object chain,
regardless of where in the chain extensions are located. Consider:
"C -> B + ExtensionB -> A + ExtensionA" is interpreted as
(old) ExtensionB -> ExtensionA -> C -> B -> A
^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^
cloned meta objects static meta objects
(new) C -> ExtensionB -> B -> ExtensionA -> A -> C -> B -> A
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^
cloned meta objects static meta objects
One can notice that we now clone _more_ meta objects: this is to
be able to to create a chain with correctly ordered properties
Unify the proxy data creation under QQmlMetaType::proxyData()
Update QQmlProxyMetaObject which now has to deal with different types
of proxies: not only extensions but also "cloned" self. CustomCall
metaCall() of QQmlProxyMetaObject is also adjusted to ignore
non-extensions
Change-Id: I40e1547a9c05a8504ab98bc06a6bc412a2460783
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Previously the extension's property revision would make
the property unusable since extensions would've been skipped
from property cache construction w.r.t. revisions
This is due to the meta object cloning that we do for
extension types (since we put the cloned meta object on top
of the meta object hierarchy for the QQmlProxyMetaObject).
Once cloned, the meta object has no associated QQmlType
anymore and we need one to deal with revisions. Overcome this
by registering the cloned meta object in the QQmlMetaTypeData
From now on, the cloned extension meta object has an
associated QQmlType, which is the *extended* type, NOT the
*extension* type
Change-Id: I4a6a4380278b80e49e1b9874dd458183667e5cb5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
If a component is bound to a file context, we can be sure that the IDs
present in the same file will be accessible to bindings and functions
inside the component. We will need this to allow such bindings to be
compiled to C++.
[ChangeLog][QtQml] You can now bind components to a file scope. This way
you can make sure IDs in the file are accessible to the components.
Task-number: QTBUG-101012
Task-number: QTBUG-102806
Change-Id: I290a61752b4b02e13f0bb0213ba3f871bdb95260
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Introduce a compile-time procedure to distinguish types without
extensions but with base type extensions from types with direct
extensions. Previously, we would have treated both cases the
same due to the C++ mechanism employed to mark a type as
extension-containing
As a drive by, make QQmlMetaType::clone() use class name of the
extension when we clone the extension
[ChangeLog][Important Behavior Changes] A derived type is no longer
considered to be extended itself when only its base type is extended.
Instead, the extension only exists on the base type.
Change-Id: I74092a5f88cad09c1e07626ae90bb986db0da73d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Added moduleName and qualifiedName to QQmlJSScope. Those
properties are written in the scopes after they were
loaded by readQmlDir.
Fixes: QTBUG-103299
Change-Id: I3b2c68c43c3bf0ac6cf801b0e54cf4b412b4d4e5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
We previously hit an assert / crashed if we saw an empty script binding.
Fixes: QTBUG-103707
Change-Id: I117d984a7d315ecf860d2ada5568637d154ae083
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
QQmlListProperty is only for object lists. Object lists are the only
thing we can use in LoadElement for now.
Fixes: QTBUG-103529
Change-Id: Ia120addcfc0afcbf1815d1bd9671f20df8334744
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Previously we would often suggest to add an id to the view containing
the delegate so you could access the model that way which is very
misleading and might be especially bad as an automatic suggestion.
This change now recommends that the user adds a required property,
although we currently lack the logic to properly insert one for the user.
Fixes: QTBUG-103101
Change-Id: I4cd858ff6617d12b9abf070f524dc626d699e4f1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The TimeZoneSwitch class was setting the doChangeZone flag incorrectly,
so it was actually trying to change the zone only for "localtime".
This patch fixes the issue.
With this fix applied, the test started failing on some OS that fail
to change local timezone, so skip such input data for these
configurations.
Fixes: QTBUG-100014
Pick-to: 6.3 6.2
Change-Id: If39a15fe1008211a940174fdc3aa5209df34c115
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This change reimplements the PropertyPass to be based on bindings
rather than on just iterating over elements. This is a lot less
cost intensive than iterating over all properties regardless of
whether they are actually used. You may still achieve the same
thing with the more flexible element pass, just with the benefit
that you can choose what properties you want to iterate over
instead of iterating over all of them.
To demonstrate the passes usefulness the existing attached property
warnings are ported to use the binding pass and can now also warn
when an attached property is read or written in a context where
it's not supposed to be used.
Fixes: QTBUG-102860
Fixes: QTBUG-102418
Task-number: QTBUG-102859
Change-Id: Iea87a1b05b954429b8bf00fd27b60487940af679
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Implements anchor related and back/left/behind combination warnings.
Also adds a quality-of-life improvement in tst_qmllint where we print the
line when an expected message is missing.
Task-number: QTBUG-102277
Task-number: QTBUG-102859
Change-Id: I56068c75e3c6187845b079a6689debefa363a5e4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Introduce a private version of qmlExtendedObject() that returns an
index-based extension (where 0 represents an extension on the leaf type
and N represents a (N - 1)th base type's extension)
Teach QQmlProxyMetaObject to distinguish different extension proxies.
Its custom metaCall can now query up to 128 extensions (should be enough
for the user needs)
Change-Id: I5520a1e84501f1f9fe6a8e77d8269009a12c255c
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We can have QQmlDelegateModel pick specific roles from model items. That
can easily be done for variant maps, variant hashes, objects and
gadgets. We would like to do it for anything that has a
QMetaAssociation, but as we cannot get to the original type at that
place, it's currently not possible.
The special case about variant maps with exactly one item in variant
lists is clearly insane and therefore not included in the
generalization.
This requires some cleanup in the QQmlGadgetPointerWrapper. Passing the
wrapper itself to QMetaProperty::read() has always been a rather obscure
way of reading from the gadget.
Pick-to: 6.3
Fixes: QTBUG-102983
Change-Id: I84ecef980783e7137aa4d77070ddce47b6ead260
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QML_{NAMESPACE_}EXTENDED and QML_EXTENDED_NAMESPACE are supposed to
behave differently when it comes to visibility of properties, methods,
etc. Thus, make it so by actually using different class infos and
updating QQmlJSScope. Use a HasExtensionNamespace flag to differentiate
between extension and extension namespace (whenever one of them is set)
Update the internal search routine that traverses the base types and
extensions of the given scope
Change-Id: Ifafbb22f831f5b128e431a3e65c514ffdf65eb73
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Do not go over extension's base types since this is not how the engine
logic work. Instead, only assess the direct extension type when
traversing the base type hierarchy. The special cases are value types
which still need base type extension traversal (e.g. due to Number
and NumberPrototype extensions on primitives) and QObject type itself
(we expect to see ObjectPrototype properties / methods of it)
Pick-to: 6.3 6.2
Change-Id: I92ba979202b33f16e1a7b948d4f1e79df37f2669
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
When converting a JS value to a variant, if we notice that we get a
QJSValue again, there is no point in trying to convert it further. We'll
just run into infinite recursion.
Pick-to: 6.3
Fixes: QTBUG-102545
Change-Id: I0a40e21287e5460e5e214101aabe8d2b4bf0afad
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The name of the module's folder should match the URI and
application binary dir should be provided as an extra import
path for the module to be discoverable
Change-Id: I00d67593d18dc86c0929f8a64b2c165221a4758a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Grouped properties do not bind to a default property and they are not
object definition scopes. Fix the subtle issue where we'd do the
opposite for `group { ... }` syntax
Submit the tst_qqmljsscope changes that made the issue visible
Pick-to: 6.3
Change-Id: I314b19d5cad62f70146d228e5402c9fc73b309ad
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Qt/QML allows marking a type with QML_EXTENDED_NAMESPACE(Type) where
Type is a Q_OBJECT. In this case, we have a Type-specific meta
object but do not have an extension function to create the object of
that Type with, causing us a subtle runtime crash. The crash in fact
happens when we attempt to access a shadowed property through the
extension object (which surely fails since there's no extension object)
Fix this by excluding properties and methods when cloning the metaobject
for the proxy if we know that the proxy cannot be created. This somewhat
matches what the documentation says about QML_EXTENDED_NAMESPACE:
When we have a Q_OBJECT/Q_GADGET, methods and properties of that are not
exposed
As a drive by, add the same check to the QQmlMetaType::proxyData().
While untested, this seems logical since the proxy data assumes valid
creation function in this case as well
Fixes: QTBUG-103081
Change-Id: I63c6e535d4df5169e0279eb2f588593f43a70640
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
a) Test-document the behavior when we have QML_EXTENDED() with a Type
which itself does not provide any properties but instead has a base type
that does. In this case, we won't consider base type properties from
extension in the meta call resolution, using the non-extended properties
instead
b) Test what happens in various cases of property existing only in
extension type
Change-Id: I5340e8d6606b2f170e9766716871c5a6a8cba948
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Previously we only warned when a component we were linting contained all
of the anchor properties causing a conflict. Now we also warn if the
combination is created across multiple components or files.
Also makes QQmlJSMetaPropertyBinding record undefined literals as they are
needed to tell whether a property has been reset somewhere in a type.
Task-number: QTBUG-102859
Change-Id: I04012848d0526cce6aea34036c6b2e0daf79cf9d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Introduce an alias resolution procedure to query the origin
property and its owner for a given alias
Add alias compilation to the "proper" qmltc code and remove
the equivalent one from the prototype
Change-Id: I55bc1e3e6206b4cfce259526d1bc2813e8ea7cfb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QLocale reversed the order of languages returned from uiLanguages()
recently. Adapt the test to this change.
Fixes: QTBUG-103026
Change-Id: I471351494bd56e48d1cf4bee3f6f27a786c5b107
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The test was failing because it was using QML code that was embedded
directly in the test, so the dependencies were not detected and
deployed.
This patch moves QML code into separate files, so that qmlimportscanner
could provide all the necessary dependencies.
Fixes: QTBUG-100166
Pick-to: 6.3 6.2
Change-Id: I5581de9a4573204722ad60eaceae8d05a491eb13
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
When the data directory is located in qrc (like on Android), the data
directory url was generated incorrectly, missing the last '/'.
As a result QQmlDataTest::dataDirectoryUrl().resolved("something") call
was providing incorrect results.
This patch fixes it, which allows to unblacklist
tst_qqmlqt::resolvedUrl() for Android.
Task-number: QTBUG-100014
Pick-to: 6.3 6.2
Change-Id: Id336a698b493edaa6e2ab7d36efbbef1f5acd1d6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The most important places where we want to avoid early execution of
deferred bindings are checked with QtQuickControls' tst_sanity. The
whole thing is private API, so users cannot run into this themselves.
Conversely, if users trigger early execution of deferred bindings, that
may be on purpose.
Fixes: QTBUG-98964
Change-Id: I81e5391ff1059137fa8eba8cdd39f58262f22252
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The flaky test hangs and is eventually registered as a crash in
the CI.
Task-number: QTBUG-101678
Task-number: QTBUG-101972
Task-number: QTBUG-102984
Change-Id: Id12b0c7032d31c97b24b6cf88fcbf2f28be1c293
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Previously we warned when an anchor was null again after already
displaying a generic warning about a type mismatch. This is redundant,
so let's stick with the generic one.
Change-Id: I8f43d279b712d728dc154f48286b8d5c0dac9976
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Implements QQmlJSScope::prettyName() which will strip off any internal
prefixes (such as $internal$ and $anonymous$) and also return some more
user recognizable type names (i.e. null instead of std::nullptr_t).
Change-Id: I085b51ea9fe6b348fb24efa93726c47b79846a8b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
As we deal with unsigned integer indices, there's no point in testing
them for >= 0 as this is always true. Apparently it is a -Wtype-limits
warning for some compilers
Change-Id: Ic5d633c2cc73f811f127f16f4d769d154364ccd0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We can transition to absolute indices (within the compilation unit)
from the relative indices we already have in each method and script
binding. Together with absolute indices, we also need to acknowledge
nested closures that some AST elements might have and so also store
nested runtime function indices along with the absolute ones
Absolute runtime function indices (and the nested ones) map to the
indices we store and use within the compilation unit at run time,
which are used to dispatch to correct JavaScript call during e.g.
binding evaluation - see QQmlEnginePrivate::executeRuntimeFunction()
Change-Id: Ieec58fbc36563511bd9763e358cda46c67757fa9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
When creating a property and a signal, the indices can be different.
Task-number: QTBUG-102454
Change-Id: Id459d6476a6b1dc6c3d524ed3fe34d8d5535a3af
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If we cannot create the attached properties object, we need to generate
an error and return early. The attached properties are unavailable then.
Pick-to: 6.2 6.3
Fixes: QTBUG-101401
Change-Id: I92539ba577b435675f812c4a2bdbbbfd1de65ecf
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The engine will warn when various attached types are used in elements
where they are not supported.
This patch replicates this behavior in qmllint with the exception that
we cannot handle them being used in bindings right now.
Task-number: QTBUG-102277
Task-number: QTBUG-102859
Change-Id: Ic41c9338d8625c5185dbd658cc8987f3c00f18c3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
When using Grid and Flow, children are not supposed to use anchors or
the x and y property. The same applies to the children of Layouts which
in addition should not set width or height.
This change adds the warnings when these properties are set improperly.
It also adds tests for the existing warning about the children
of Layout not being allowed to use anchors.
Task-number: QTBUG-102277
Task-number: QTBUG-102859
Change-Id: I83c553569cdba90c8841802090d4ef534583ecb8
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The test was skipped on Android because it was trying to read the
contents of default directory for FolderListModel, which requires
special access rights on Android. The test passed when started via
androidtestrunner, but failed when launching the APK directly.
Generally this test does not need to get the number of files in the
default directory. It just needs to know that its processing is
finished, so that we can switch to other directory, and do all the
checks there.
So this patch waits for folderChanged() signal instead of verifying
that the number of elements in default directory is > 0.
Also skip the parentFolder property check on Android, because the
qrc path is not resolved to be a local directory, to parentFolder
always returns a default-constructed QUrl.
Fixes: QTBUG-77335
Pick-to: 6.3 6.2
Change-Id: I95510ebad724db42890414b810b2350be0d8dcac
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Fix couple of previously blacklisted tests:
- tst_qquickfolderlistmodel::nameFilters()
This test had a problem with permissions to read the contents of
default directory. This is not an issue when running with the
latest androidtestrunner, but can be a problem when directly
launching the test's APK. To avoid inconsistency, this patch
sets the default dir to resources root dir, because it's always
readable.
- tst_qquickfolderlistmodel::introspectQrc()
This test had a problem with incorrectly generated qrc file.
This test has two qrc files - one for all test data, as it's
usually done for Android, and another one - to test that custom
prefixes work properly. The latter resource file had an invalid
alias (which included the "data" dir).
The reason for the error was that the same data file was already
process when the global resources qrc file was generated.
At that time the alias prefix was set, and then reused.
To fix it we need to explicitly reset the QT_RESOURCE_ALIAS
property before generating the second qrc file.
Fixes: QTBUG-100016
Pick-to: 6.3 6.2
Change-Id: I04896c3f8d7e845a087a74f841fdad54cb6471f9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
QML can create a function which holds a closure in the cases like:
onSignal: function() { ... }
If the left-hand side is a signal handler (or similar), we want to
execute the *inner* function when a signal is called, not the outer
one. However, under certain conditions (e.g. we use `this`), the
outer function must also be called beforehand to correctly setup the
calling scope for the inner function
Thus, make the QQmlEnginePrivate::executeRuntimeFunction() do that:
always call an outer function first and then the inner one if present.
This creates an overhead when dealing with certain signal handlers but
we could optimize it later if needed
Note that the case `property var prop: function() { return 42; }` where
a property contains a callable function is no longer supported by the
executeRuntimeFunction() routine (we always call the inner code now).
This is fine since qmltc (the main beneficiary of the routine) does not
rely on this functionality when dealing with property bindings
Given the change, qmltc can be simplified to only work with absolute
function indices, ignoring the nesting problem altogether
Change-Id: I61f61587b6fe700cb695b3b7a213d9cfab0eb746
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
tst_QQmlXmlListModel::threading() tried to create some temporary
files in a qrc: path on Android. This patch changes it to use
a QTemporaryDirectory for it.
Pick-to: 6.2 6.3
Task-number: QTBUG-101865
Change-Id: I66b44344af822edfe86b0007ae56a65d5da46365
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
tst_qmltc_diskcache keeps appearing in test failures.
It is flaky. And it seems to be a special kind of flakyness: On some
days it always fails, on other days it never fails. It does not seem
to be random.
Pick-to: 6.2 6.3
Task-number: QTBUG-101342
Task-number: QTBUG-101865
Change-Id: Ia6716d38a10f348199d3582be8453d52f331a8b1
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
tst_QQmlXmlListModel::source() assumed that local files are loaded
immediately and others later.
This is not true for files in the qrc: system. They are not local
files. But still, they are loaded immediately. This patch
fixes the test.
Pick-to: 6.2 6.3
Task-number: QTBUG-101865
Change-Id: I13a449cefe12135d4c6cd7687c80f41b7333349e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
tst_qqmltranslation::translation(qrc) had a problem with incorrectly
generated qrc file. This test has two qrc files - one for all test data,
as it's usually done for Android, and another one - to test that custom
prefixes work properly. The latter resource file had an invalid
alias (which included the "data" dir).
The reason for the error was that the same data file was already
process when the global resources qrc file was generated.
At that time the alias prefix was set, and then reused.
To fix it we need to explicitly reset the QT_RESOURCE_ALIAS
property before generating the second qrc file.
Pick-to: 6.2 6.3
Task-number: QTBUG-101865
Change-Id: Ibd7e2a41ffffc3601db9722d155932a3cc9a9b54
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Includes more anchors related warnings that get usually get
shown at runtime.
Task-number: QTBUG-96737
Change-Id: I2a72d7fc9b23072f85d20fff558e39311e749e4c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Store relative (to scope) index for every Script binding and JavaScript
function into the corresponding data structure within QQmlJSScope. We
need this at a later phase in qmltc when code generating JavaScript
calls into the engine
For now, ignore the logic that converts the relative indices stored into
the indices pointing to the runtime function table
While testing the addition, observe missing cases where we do not record
bindings as such and fix that
Change-Id: I85030b7937c97f83183f88ae242af3a5f223443c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This patch moves a code snippet from a string into its own file,
so qmlimportscanner can see it and pull its dependencies.
Second, this patch enables removal of '\r' in an expected log
message, as this seems required now.
Pick-to: 6.2 6.3
Task-number: QTBUG-101865
Change-Id: I25b35e166a7edb6f3aaaa92a3134347804d1c6c1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Commit 8398f6990b added
#include "debugutil.moc"
but debugutil.cpp doesn't contain anything that would produce such a
file. This leads to a flood of AutoMoc warnings when building the QML
debugger test.
Presumably, it was meant to include moc_debugutil_p.cpp, so let's do
that.
Change-Id: I86dfe935e7a01388f6737124d9383ad53a772897
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
The QQmlPropertyCache ctor that just takes a QMetaObject is really
dangerous. It misbehaves for anything but plain QObject. Remove it.
Also, realize that we never want to update a property cache
"recursively". That is, each property cache maps exactly one metaobject.
We cannot cover multiple metaobjects with the same property cache.
Finally, any property caches constructed dynamically must not be
recorded in the type registry. These caches are not comparable to
anything else. Introduce a special method to create them.
Fixes: QTBUG-102454
Pick-to: 6.2 6.3
Change-Id: I47a1ff0f467e9444ff9f581ffcdf0a8b5730b0b8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
qmlimportscanner is not told about the correct path to CustomModule.
This patch blacklists the tests while waiting for a fix.
Pick-to: 6.2 6.3
Task-number: QTBUG-102833
Task-number: QTBUG-101865
Change-Id: I9c1b1a7f6f5e52a156cb03e954959ecd5c26e1ff
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Instead of a bool we can just return an enum of the actual kind. This
way all the checks become more readable. Furthermore, we can eliminate a
dynamic_cast without sacrificing readability.
Change-Id: I8a38687f9b796cd47196a6ab0385624c737e4435
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We do not want to wait until reaching the Component destructor (at which
point e.g. the engine might be gone).
Pick-to: 6.2 6.3
Change-Id: Ic0e4383ec4e3759d9f02847413a25191a01286cb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
With grouped properties, we might end up with a completePending state
afer construction failed. If the engine then is deleted before
~QQmlComponent runs, we then have a null creator pointer in the state
(see the connect to QObject::destroyed in the ctor).
Use an if check to guard against this.
Pick-to: 6.2 6.3
Fixes: QTBUG-102425
Change-Id: Iec27cb003a81b1f72317b87297832025c74cbfe9
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
In case of incomplete type information, we can get QJSValue as output
type where we expect QObject*. We cannot generate any sensible code for
that.
Change-Id: If817de7dca3b5b0b58aff92dec2dd12a7c10d250
Pick-to: 6.2 6.3
Fixes: QTBUG-102554
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Extend group property binding creation with attached properties case
As a drive by, add extra attached property tests for QML and qmltc,
covering the case where an attaching type exists in both base and
derived types
Task-number: QTBUG-102082
Change-Id: I6c0d2b941da72d6dab7fc05a4f7b2a7875423ef0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Cover the following case of binding on a group property:
Type {
group { foo: 42 }
}
Task-number: QTBUG-100168
Change-Id: I0147c74dffb649907457d5f17a2ab29473101a6d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Document (via test) what happens when we re-assign a group property in
the derived scope
Introduce a QML test module along the way used within the test
As a drive by, add all QML test files to TESTDATA
Change-Id: Id4c3e20e45b8e0f3757840c87e0285f8516319a8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Adds a method to the PassManager to check whether a QML document has
imported a particular QML module.
This is important as a lot of linting passes only need to run when a
certain module is present and can be skipped otherwise.
Checking for the module is accomplished by adding an invalid
$module$.<URI> scope to the imported types generated by QQmlJSImporter.
This means that not only direct imports but also indirect imports caused
by a qmldir import line will be properly detected.
Change-Id: I341f916a43c60d373d205b5571104d5c5a533d61
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The test was extracting plugins from the installation directory.
However on Android plugins can be read only from APK's libs subdir.
By default no plugins are copied into the APK, because they are not used.
So add a dummy.qml file which uses some basic stuff from Qt.Quick and
Qt.Quick.Controls. This will force the plugins to be copied into the APK.
Fixes: QTBUG-100169
Pick-to: 6.3 6.2
Change-Id: I31d7a407c655e19f147d461a083f27d6f6cbda72
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
tst_qv4debugger::conditionalBreakPointInQml() failed on Android
because dependencies were not available.
This patch moves qml code from strings to file, thus exposing it
to the build system. This way, the build system can take care
of the dependencies.
Pick-to: 6.2 6.3
Fixes: QTBUG-102416
Task-number: QTBUG-101865
Change-Id: Icd6ef43a45642f68e749137a963ee2ebfe462bce
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The binding that creates the element inside of a Component has no name.
Pick-to: 6.2 6.3
Fixes: QTBUG-101655
Change-Id: Ib2ff272cff4f21efb588553d55d1e348e2ee5f87
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Tracking the change signals is brittle and error prone. We have bindings
for this case. Let's use them. We can construct a synthetic
QV4::Function that contains its own QQmlJSAotFunction. In order to pass
the property index to the function we generalize the "index" property of
QQmlJSAotFunction to contain any extra data the function may want to
use. If there is no compilation unit, we pass that instead.
Fixes: QTBUG-91649
Change-Id: I0758bcc4964a48c6818d18bfb0972e67dbc16a1f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Apparently we cannot close the dialog anymore once it has been opened.
Use a non-native dialog instead.
Pick-to: 6.2 6.3
Change-Id: Iced08fe83fcaa9890d002cf91f73987c1ee97a95
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Apparently we do that somewhere. It should not just crash.
Pick-to: 6.2 6.3
Task-number: QTBUG-102147
Change-Id: Id612e0543d8794aa4f334a899b117142b7a8cd38
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In Creator's hello-world QML example, we currently have to do quite some
unhandy logic to check whether creation failed: Connect to
objectCreated, and then check whether the object is nullptr in a
lambda.
Provide objectCreationFailed as a more convenient alternative for when
we are only interested in the error case, and do not want to do anything
with the created object.
This allows simplifying the hello world example to a simple connect of
the new signal to QCoreApplication::quit.
[ChangeLog][Qt Qml][QQmlApplicationEngine] Added objectCreationFailed
signal as a more convenient way to check for errors than objectCreated.
Task-number: QTBUG-47996
Change-Id: I6513bf726807de183a604e03379e65515e090ccc
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
The type conversions happen before the value is read. Therefore, we need
to record them in this order. Otherwise, we may lose a type conversion
if the instruction writes the same register as it reads.
Fixes: QTBUG-102281
Change-Id: Id63a69f86af90c8dc987c0301db3958322c006a1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We had a typo in there.
Pick-to: 6.2 6.3
Fixes: QTBUG-102309
Change-Id: I11eb9d35fde3b92d2e48e845740379e10c53774a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
tst_qqmlenginecleanup uses test data, but in was not properly
included. This patch includes it. tst_qqmlenginecleanup does not
work after this patch, so further repairs are necessary.
But this is a required step.
Task-number: QTBUG-101865
Pick-to: 6.2 6.3
Change-Id: I4739036249565ce6b78adff8f394436d184d9ae8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Factor out the name construction routine duplicated all over the place
and apply it to all places where it was missing.
Fixes: QTBUG-102147
Change-Id: I7c93b4878cedf3489b978591da8d8dfbb2b98c9b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
tst_qmltc_manual did not find its test data. This patch
fixes it.
Fixes: QTBUG-100018
Task-number: QTBUG-101865
Pick-to: 6.2 6.3
Change-Id: I5c59937bb20f0ed904d7c1dec6ab543df9aba499
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Instead of an unnamed enum, make these extra flags of the correct
type, C::Flag. This is the same technique used a few lines up for
extra C::Group flags.
Pick-to: 6.3 6.2 5.15
Change-Id: I2dd5221f95bfa49c93e9cbf9d8583ac38c24de95
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
tst_qmlcppcodegen tries to start itself again using QProcess.
This does not work on Android. This patch skips this test.
Task-number: QTBUG-101865
Pick-to: 6.2 6.3
Change-Id: Ib8f9a5e028a938949347bc8e83ea483d0228968e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Integrates the plugin and pass infrastructure into qmlcompiler and qmllint proper.
Plugins are searched for in the "qmllint" subfolder of the Qt installation's plugin
directory. In addition we also support loading statically linked plugins.
[ChangeLog][qmllint][New Feature] qmllint can now be extended via plugins. Use --plugins
to get a list of available plugins.
Original-patch-by: Fabian Kosmale <fabian.kosmale@qt.io>
Change-Id: I75a09dd978fc7724aca4931f055cc71c7ced971b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
tst_qqmlproperty tries to start itself in another environment
using QProcess. This does not work on Android.
Task-number: QTBUG-101865
Pick-to: 6.2 6.3
Change-Id: I8e0410cf315e53899a88cf1b3c9dfba605b7f4d9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The factory should populate the pre-existing scope rather than copy it
into place. This way we can detect inheritance cycles involving the
pre-existing scope.
However, now we may detect the inheritance cycles earlier, when
resolving the types inside the lazy loading. We have the right pointers
available there now, after all. Therefore, add a way to propagate base
type errors out of the factory. When clearing the base type, we can now
give a reason for that. When checking the inheritance cycles we
retrieve that reason and log it.
We also remove the special casing of the ScopeType property of
QQmlJSScope. There is no real reason to set it in the ctor. As we
delay the population of QQmlJSScope now, we have to set it later.
Pick-to: 6.2 6.3
Task-number: QTBUG-102153
Change-Id: I49cf6e20f59fbdb6ed98a82040b3b159676f5975
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We only care that the parser can parse, and warnings shouldn't affect
that.
Change-Id: I22bab85dbe6cb2f41640adaaa53cb8c85394773b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
When detecting an ambiguous type, we need to invalidate the entry in the
list of types, rather than delete it. If we delete it and we get yet
another version of the type, we'll add that one just like it was not
ambiguous.
Furthermore, we cannot check the type name when looking for ambiguity.
The QML name can be bent and twisted in various ways, to import
ambiguous-looking types under different names, so that they are actually
not ambiguous.
Pick-to: 6.2 6.3
Fixes: QTBUG-102153
Change-Id: Iee7951229c5f68b168899e55164e8cf91587eec1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Declare the signal handlers as functions.
Change-Id: Ie583a123054cbc090245ccc55e7de9ac83397372
Pick-to: 6.2 6.3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Still lacks support for merging and resolving grouped bindings, but
this will be handled in another patch.
Task-number: QTBUG-100168
Original-patch-by: Fabian Kosmale <fabian.kosmale@qt.io>
Change-Id: I1bb73f383acc3c8512676db47c5944f369b904b7
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Some classes (e.g. QQmlDelegateChooser) depend-on / inherit QmlModels'
functionality. We need to propagate that dependency to QML via qmldir
entry, otherwise we won't be able to see the types in QmlCompiler lib
Note that we already depend more strongly (via linking) on the
QmlModels library, so there is no reason not to depend on the QML
module in qmldir
Pick-to: 6.2 6.3
Change-Id: I4f16f66f2910fb6afd38475cd6ba3209cfd1207d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It does not seem correct to be able to use this function for both sides
of binding expressions: the property type and the assigned QML type
(`<property> : <qml type> {}`). Instead, it should really be a function
that considers both sides together (and actually checks the sides
differently!)
What we really should do for the assigned QML type is figure whether
its *first* non-composite base is a QQmlComponent - not just that it
is a QQmlComponent itself. Leave the QQmlAbstractDelegateComponent check
in place since this part is correct
The property itself, on the other hand, seems to cause an implicit
component wrapping if its type is QQmlComponent-derived (which means we
have to check the full C++ hierarchy)
As a drive by, also update QQmlJSScope::canAssign() since it used the
old function internally and was ignoring the case when a to-be-assigned
type lacks a C++ base type hierarchy (e.g. because it does not exist
ahead of time)
Pick-to: 6.3
Change-Id: I23524fa54d45d9140e1cafd9f81ef1f68d95f3a7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We should not invoke the base toString() method if there is an override
in a more specific type. This involves lowering the priority of generic
JS lookups when resolving scope properties, in favor of context and
scope lookup.
[ChangeLog][QtQml] You can now override the JavaScript toString() method
by providing a Q_INVOKABLE method of the same name in your QObject-based
C++ classes.
Fixes: QTBUG-87697
Change-Id: I6190111f4c28e54ce76c391c69c4a921e290e612
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Extra event loops are famously brittle, and we don't need them here. We
can just us QTest::qWaitFor().
Task-number: QTBUG-101678
Change-Id: I73837bc323c83431f487db3cac6872736635d557
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When constructing the iterator return object, the garbage collector may
run, and drop the element value we want to return.
Fixes: QTBUG-101700
Pick-to: 5.15 6.2 6.3
Change-Id: I60c9b0b9fbb9e784fa089a8b5bb274d02ef7fc1f
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
There was a condition missing in qqml.cpp making most type lookups crash
right away. Furthermore, we need to generate code for type lookups we do
need. Finally, the shadow check should skip instructions we don't need
anymore. Shadowing in optimized-out code is not very interesting.
Pick-to: 6.2 6.3 6.3.0
Change-Id: I34e9de7686528b39a35e59c616e4e28b32a6e031
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Since we load plugins and C++ based types, too, we should just load the
dependent imports as well. Otherwise this is rather confusing.
Fixes: QTBUG-101752
Change-Id: I5bd8afa22e5f16141ef8b47c1a40d3ba8698106c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
We just have to return a plain metaType if it's neither an attached type
nor a singleton.
Pick-to: 6.3
Fixes: QTBUG-101811
Change-Id: I6a78ffe4504606d0cb34f1a6ca9d5511a3447d7f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
tst_qqmllistreference.cpp:828:23: warning: 'QQmlListReference' is deprecated:
Drop the QQmlEngine* argument [-Wdeprecated-declarations]
Since without the engine argument the test case is identical to the
previous block, we can just as well remove it.
Change-Id: I4e4b29a69dfdd60ed1678361d7796739ecead41e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
QJsonArray doesn't hold QJsonValues, so we can't iterate over references.
Use QJsonValueConstRef instead.
Change-Id: I0246e2406b2f3d5aa2cd5382d17396717d899dfa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Replace deprecated QString::count with QString::size or QString::length,
depending on context, and use qsizetype instead of int.
Pick-to: 6.3
Change-Id: Ie4c08abd2cf2ba771c23e8def72756170cc07af7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The mutex had no function I can discern as the class is not thread safe
in any way, and isn't used from multiple threads anywhere. Extra event
loops are famously brittle. We don't have to use an extra event loop
here. QTest::qWaitFor will do just fine.
Task-number: QTBUG-101678
Change-Id: If25a961312a1eeb725ff779e386b2657e0f23dd1
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The test works fine with the window hidden. Trying to show it gives
problems in the CI. We also want to avoid showing windows in non-GUI
tests as far as possible.
Fixes: QTBUG-101738
Pick-to: 6.2 6.3
Change-Id: I206f74f940e6ba7ac6346c85459b896387ab85a5
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Check that this kind of signal is also accessible in the "extended"
QML type.
Change-Id: I81ba60c23dc96723a97f1b3df5b0a6c46dba77ba
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Makes sure we also look for suggestions in extension types. Adds two new
methods to QQmlJSScope called properties() and methods() to easily get
all of them across base types and extensions.
Change-Id: I5874c0221bac6d6e317b79146227bf749100f05b
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
QString::count() is deprecated, and also the "engine" argument to
QQmlListReference. Also, properly convert the results of "length"
retrieval.
Change-Id: Ib7edde1326a0347902174a23147086b9deccfe17
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Using the type cloning and adaption mechanism we can now determine what
kind of list we have to create in order to avoid a later conversion. We
can even propagate the type adjustment into the element types we read.
Fixes: QTBUG-100157
Change-Id: Ia2f160ebae56f39ee5946f49d2f8c5b4986a6b77
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
You really should not mess with that after creating the property cache.
Change-Id: I070200772475bb67f539dbbd85a298020b14ca79
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We're not supposed to modify property caches after they've been created.
Task-number: QTBUG-73271
Change-Id: I0ab8ed6750508fa4e28931995142f56cd5fa3061
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Previously we didn't search for possible fixes for typos in enum keys,
this change makes sure we can also offer corrections for enums.
Also adds a convenience method to QQmlJSScope so we can get all
enumerations across base types and extensions.
Change-Id: Id1f79a9d0a2a3b54b2ad3dfb7d8a71e6a276ce39
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
We now support automatically applying fix suggestions that don't
need any additional user input. This allows us to automatically
solve issues such as unqualified access and multiline strings.
[ChangeLog][qmllint][New Feature] Added the ability to automatically
fix some warnings, use -f to automatically fix your files or add
--dry-run to see what changes would be made first.
Change-Id: I2dc7587137d74267f60c08bb94a035f1a85a62b1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Otherwise, it will break top-level builds, as moc might not have been
build yet.
Fixes: QTBUG-101617
Pick-to: 6.3
Change-Id: Id938c2e96575b6f2ad65cd5d6f8fe2af1421b02a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
- It is not possible to build all autotests for STATIC build, because
CI doesn't have enough resources.
But it is possible to build a few tests on CI for INTEGRITY testing.
Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I698edb9cd0696dd55e1b82547cb57c34b993bb10
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Which is uses of take() and swap().
And replace it with std::unique_ptr.
Change-Id: I2580383c1d2af0ba6103a66f034235905e0988ac
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This helps make our tests more structured and will also allow for
many other improvements down the line.
Also gets rid off our hack of constructing fake logger messages to
check against.
Change-Id: I0bbafc32c99ecb7abc7be1c6416e4d5903aff22c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Amends 16f0d38d56.
From 0fc8a511ba, it seems that
not only Android is relying on these imports to satify
qmlimportscanner, but also Integrity. So rename the imports
to something generic and remove the explicit mention for Android.
Pick-to: 6.2 6.3
Task-number: QTBUG-97056
Change-Id: I9273fd0f9201a805cad4d588847796f7daecb686
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
On 32-bit Android x86 using a length of 0xffffffe throws an
"RangeError: ArrayBuffer: out of memory" instead of the expected
"RangeError: TypedArray.set: out of range".
Pick-to: 6.2 6.3
Task-number: QTBUG-99193
Change-Id: Id6deea18fe90228db616ddc7550c7832825c297a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Revisions before QML_ADDED_IN_VERSION and revisions after
QML_REMOVED_IN_VERSION should both result in anonymous types. This way,
you can then derive from the type in question and expose the derived
type in a different set of versions.
Pick-to: 6.3
Change-Id: Ia59258047fc242c809c27525bb75fd2797fe5aab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If we are dealing with dynamic metaobjects, the QML engine may not
create property caches. We cannot see this at compile time. Therefore,
we need to establish a fallback infrastructure that does the same
operations on plain QMetaObject.
Pick-to: 6.2 6.3
Fixes: QTBUG-101349
Change-Id: I8c936fc077b0018df71196620b6987825253cb39
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When a property is required after declaration, now show the scope where
it happens including full location information and context.
Change-Id: Iddd2d0e543406ab479b4af1a5e74682328998d74
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Previously the test would always return true regardless of whether or
not the feature was actually working properly. Now the feature is both
used by default for all tests and properly tested in an enabled and
disabled state.
Change-Id: I9fc76319b83ba345da20f2d7c16272593bd5ca3f
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This renames all qml files added before to allow qmlimportsanner to
include the necessary modules into Android packages, into
android_dummy_imports.qml, and also adds a comment in each one
describing why it's needed.
Pick-to: 6.2 6.3
Task-number: QTBUG-97056
Change-Id: I7fc0514dd9e5bc10849fdd0503547e1a75242414
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This allows us to enable testing on declarative for the module
as a whole and have some sort of test verification for the mean
time, and fix the fails over time.
This also disable tests like qdom and qjsscope which are host tests.
Pick-to: 6.2 6.3
Task-number: QTBUG-100991
Task-number: QTBUG-99194
Task-number: QTBUG-101005
Task-number: QTBUG-101006
Change-Id: Ie7ae5b8e0ccdf2f55ce3568091d513a073c48417
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2nd round of test failures fixes for Android. Mostly resource bundling
related issues still.
Pick-to: 6.2 6.3
Task-number: QTBUG-97056
Change-Id: I2fac0710a7b5528fcef4480babd0cbf749e488b3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We can now suggest a template string to use instead that is properly
escaped. Once auto-fixing becomes available we can automatically replace
deprecated multiline strings with the new suggestion.
Task-number: QTBUG-92448
Change-Id: I4e77820b66ae960cde558a62689c5da328b8df5b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This looks bad and doesn't follow our coding guidelines or what our
formatter would produce.
Change-Id: Iceccb4cd1d9cccd84d49ded426f7ce184839b095
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
It seems MOC does not like methods named "isnan" on Android.
It generates a call to "__builtin_isnan".
This patch is a workaround. A real fix in MOC would be better.
Pick-to: 6.3
Change-Id: If73a4d7580ac51f6c60f4fb92c9699d077f4452f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
If you give qmltyperegistrar an invalid URI it should still not generate
invalid C++ code. In fact the module will still be somewhat usable. You
just cannot import it.
Pick-to: 6.3
Task-number: QTBUG-101072
Change-Id: I21232f99c1ef486a62dbe339f7d0ae1b9abc8871
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
You cannot just pass a resource path or absolute path. We expect a URL
after all. A relative path is a relative URL, so you can pass that.
Pick-to: 6.2 6.3
Fixes: QTBUG-98181
Change-Id: I010bc08b8cb0ff06712f7b0353955bee96ae36c1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
As we don't store void, null and empty lists, moving those is a noop.
Don't generate invalid code for that.
Pick-to: 6.2 6.3
Change-Id: Ica6714acd0ce8a5ddca44d9a397e776eb3df4247
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Returning void from any JS function doesn't quite cut it.
Pick-to: 6.3
Fixes: QTBUG-101285
Change-Id: I199813627614061ec25139277e8ea23cb844aac5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
If there are no enums in a type, we don't need the int type to resolve
them. This is commonly the case for sequence types.
Change-Id: I18b2960ef845ef797b6ef6d755648e6add1854db
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We have to add the methods first, so that the properties can be
associated with their proper notification signals once we add them. If
we add the properties first, the "missing" notification signals are
synthesized.
Pick-to: 6.2 6.3
Fixes: QTBUG-101155
Change-Id: I1aacbf33a24f7a98d05dece77c804bd7cba8a041
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We cannot convert to QVariant using QMetaType::convert(). But we can
just construct a QVariant with the desired type and data. This will
become an issue once we automatically convert argument types to match
the desired type inside the function.
As a side effect, also allow declaring "var" arguments to functions.
Change-Id: Idc14021d8d85d3d09ee7b7f286de91b56ea02bfd
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Previously whenever a property was called the warnings qmllint emitted
made it seem like the property was just not found instead of not being
callable.
Now we will warn if you try to call a property and warn about
properties shadowing methods, slots or signals. We also discourage
calling variant properties now that may or may not be a function.
This change also fixes an assert being hit in isMissingPropertyType
due to our previous, lackluster checks.
Fixes: QTBUG-101074
Pick-to: 6.3
Change-Id: I0790b4a4584f3430ee1d8ddf549611225a36cc5b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Moves the QModelIndex value types from QtQml to QtQml.Models as they
cannot otherwise be properly resolved in tooling.
Pick-to: 6.3 6.2
Fixes: QTBUG-100338
Change-Id: I30fc18b388974238ba8353e87ef09f57f8ceabd1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
We have to mark the required variables also in block 0. And we shouldn't
generate empty blocks.
Pick-to: 6.3
Fixes: QTBUG-101011
Change-Id: I0dd19f69f45f507cb83e2ddfba3060de48a940b4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In JavaScript we have a number of extra conversions not covered by
qvariant_cast. Therefore, add a method to perform a QVariant conversion
in JavaScript semantics to QJSEngine, and use that in the compiler.
Pick-to: 6.3
Fixes: QTBUG-100883
Change-Id: I8b0bfa0974bc6b339d2601fb373859bc710788c8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Rather, reject the code and let the engine handle it.
Pick-to: 6.2 6.3
Fixes: QTBUG-100980
Change-Id: Ibcd1249ba3550b40121622752b4ca22d1df3ed2a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Previously we only warned about missing property types when the lookup
was not on the current scope but only on an id, parent etc.
This change makes sure we also warn in this case and don't produce false
positives for an unqualified access.
Pick-to: 6.3
Task-number: QTBUG-100839
Change-Id: I732b8420c0c6b96dd8f93cde66a7f9813e704671
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
Simple deferred properties occur quite often in QML (throughout
Qt Quick, for example), so qmltc should be able to deal with
them as with deferred properties
Ignore generalized group properties, PropertyChanges and similar
types for now. They require more testing and are well out of
scope of the tech preview
Pick-to: 6.3
Task-number: QTBUG-100053
Change-Id: I0f3588789d188cd6bec81de0b61d3205b665a917
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Follows up on qtbase:f5762cd4b3130a650044863c5be132056f05daa5.
Use auto instead of specific QJsonValue*Ref type to avoid need for
orchtestrating with dependency update.
Change-Id: Ib47d5d8ab8373562684b42a90c97634e07869328
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
qmltc should really interpret most of qmlcompiler warnings as errors.
There could be exceptions but for now let's just reject any malicious
code (except for ControlsSanity since it is itself malicious)
Fixes: QTBUG-100052
Change-Id: Ib18741d0a46c4d0ddb40b53e34658804c0245018
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Adds the option to specify default optional imports in qmldir for
tooling to load. Previously we would just load all entries.
This allows code that that relies on modules utilizing optional imports
(i.e. everything utilizing QtQuick.Controls) to still be supported in a
limited capacity.
This change also adds the necessary CMake API to add these entries to
qmldir files. It also disables loading optional imports by default
and only leaves them enabled for qmllint.
Change-Id: Iff6aaac9cb0ec72b7a2853b60840a4d28c84aa25
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Allow for accessing QInputMethod via a singleton instead of
Qt.inputMethod
[ChangeLog][QtQuick][New Feature] Qt.inputMethod can now also be
accessed via the InputMethod singleton. This allows you to use
QInputMethod in a way supported by tooling and the compiler.
Fixes: QTBUG-95540
Change-Id: I3366757a1253b202f1fe5320e54c96b70e3b273b
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Generate an empty list when creating a list with 0 elements.
Task-number: QTBUG-100157
Change-Id: I3b0fe0b737a8ec5257785ae32231f4b687d3b204
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
They were QSKIP-ed before due to issues with importing and own module
qmltypes handling. At this point this should all be fixed with proper
QML modules so no reason to leave them as skipped
In the process of doing this, also figure that attached property code
generation is borked and fix accordingly: the compiler used an
attached type where an attaching type should've been used. Given the
obvious naming ambiguity, this was likely a typo of sorts
Also as a drive by, actually write a test for private properties which
were before only covered through QQuick-based tests on anchors and such
Pick-to: 6.3
Change-Id: I1e4fd4d916ad3bd1bacf2aee1ce2346f9283c70d
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
High-level goal: be able to reuse existing infrastructure
"as is" to configure semantic analysis categories in tools
(qmllint, qmltc, qmlsc, etc.)
To achieve that, simplify the logging to always "log"
something, without explicitly specifying the severity. The
severity is now baked into the category (and we can extend
those to cover different cases)
One slight deviation is the cache generation which likes
to do its own thing at present. Provide a "forced logging"
option where we can specify which severify we want. The
hope is that this gets removed at some point
Particular list of (noteworthy) changes:
* No more "thresholding" by the level (this is rarely needed
and is actually questionable). Instead, we can ignore a
particular category explicitly
* Category levels are repurposed as category severities
(at least from the high-level picture that always should've
been this way)
* log{Warning,Info,Critical} removed. We use category severity
instead
* "category error" makes zero sense so removed: if our severity
is:
- QtWarningMsg (qmllint), it is already an "error"
- QtCriticalMsg (compilers), it is already an "error"
* Align m_output and m_{infos,warnings,errors} stored information
* Accept the fact that we don't support QtDebugMsg and QtFatalMsg
* Additional categories added to cover for places where the same
category would be both an error and not an error
Task-number: QTBUG-100052
Change-Id: I3cd5d17d58be204f48428877bed053f756ac40a8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We know what those are. We don't need to put them into the generated
code. Do reserve variable names for those types, though. That makes
things easier.
Change-Id: I526eb862d1f5297bc3ddf91792eba87ef67fb9d2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Use QScopeGuard instead of manual calls, so even a failed test will
properly clean up after itself.
Pick-to: 6.3
Change-Id: I321f3560557e58b16cd177c623cb78b5b25111a7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Document some extra behavior details through tests
Pick-to: 6.3
Change-Id: Id05da7983406a0a61e78496a8e6483e10a7c38d1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We want to be able to construct a meaningful list type by surrounding
the internal name of the type with QList<>. Usually this works because
of the way we auto-register sequential containers for types. Only for
the builtins we need to do some special casing. That special casing
should happen in the builtins, not in QtQml, though.
The generic QList<foo> sequence type is implicitly given for any value
type foo these days. There is no need to mention it in .qmltypes.
QtQml retains some extra container declarations that are not straight
QList<foo> for a value type foo. Everything that's registered by the
value type registration anyway is dropped.
We keep the aliases QStringList and QVariantList in the builtins because
they are really common.
Since we now register QVariantList the way it's mandated by the
builtins, we also have to handle it correctly in qv4sequenceobject.cpp.
In particular, we need to append variants as-is rather than poking into
them.
As QStringList is an additional builtin now, we need to teach the type
resolver about it.
Change-Id: I0dfb5b780b27250f36f6886bc4e0926a03c114b4
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
We basically had all the code in place already, all that remained was
to use the information we have in the type resolver. This change also
allows us to differeniate between const and non-const bindings now.
Fixes: QTBUG-100444
Change-Id: Ia4dac3647a2aa3c557916e6ec1be63a46bcc6ce0
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Anonymous imports are imports of QML types that aren't visible in the
current document. Internal imports are imports of C++ types, also
invisible, but potentially of the same names.
Before, types with exports were added to the qmltypes container using
their exports if any matched. If there were no exports, we constructed a
synthetic name and inserted that. However, as the nullptr example shows,
we need a reliable way to find them by their internal names, no matter
if exports are present. Therefore, we now consistently add them by their
internal names using the new $internal$ prefix.
Change-Id: I42ac2447cd924d09970c24554e1e2a5e631c5f79
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Otherwise it will apply the '!' to the first argument.
Fixes: QTBUG-100480
Pick-to: 6.2 6.3
Change-Id: Iaefa25d062ad8bbd9d4278ffeaa52fc53ed417e2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Since all of the superfluous components of qmllint have been
removed now, we can just move what little custom linter logic
remains to qmlcompiler.
Change-Id: I91c752cb895e7d6c6f2dd4e2ccafb6cd05afa225
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This change adds a warning if we encounter a component marked as a
singleton in a qmldir file which does not contain a pragma
Singleton entry and vice versa.
Note that the warning only gets triggered if the singleton is
actually used.
Fixes: QTBUG-98558
Change-Id: Id7c63f48ba49759c15dffcaee0270c7caab2eb7d
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
qmlcachegen is not meant to be available on the target.
Fixes: QTBUG-100366
Pick-to: 6.2 6.3
Change-Id: I5cbaa62e85d9a5dd6467840eb4e3ba5e3b63857c
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
Similarly to qmllint, we should use QQmlJSResourceFileMapper
in qmltc. This should in theory allow us to avoid
implicit import dir vs qmldir path issues (where the former
comes from source dir while the latter comes from build dir)
At present, it does not seem to be the case, however. But
this is to be addressed separately
Task-number: QTBUG-100103
Pick-to: 6.3
Change-Id: Ie85799cb0a4b8b1620964000bc5939e9d046678e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Use a more canonical qmlcppcodegen-like structure, showcasing a better
QML module
As this change makes a single QML module instead of two QML modules
(for the _diskcache and _nodiskcache scenarios), there are pros and cons
Pros:
+ Prepares us for proper introduction of QQmlJSResourceFileMapper
+ Theorically allows tests to avoid (additional) weird imports
Cons:
- Denies the ability to test generated types under default QT_NAMESPACE
(in addition to user-provided namespace). This is fine as we don't
need this feature until we are able to compile QQC2 and modules alike
Task-number: QTBUG-99198
Task-number: QTBUG-100103
Pick-to: 6.3
Change-Id: I13a594a1859719bc0af3370029e6be7b1744656b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
You can use them as singletons.
Pick-to: 6.2 6.3
Fixes: QTBUG-100326
Change-Id: I8e07600657bd43ba8376279ffe39cfa5d3213c38
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
As QNX's support for feature timezone uses the TZ backend,
V4's Date.timeZoneUpdated() works, as on Linux, so tests for
this method now pass.
Pick-to: 6.2 6.3
Change-Id: Ie6c318023bdf508d9f2067ca3fa9d77b78292be5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We apply the same trick we already use for the UiObjectMember rules: We
add an ExpressionStatementLookahead before the T_LBRACKET starting the
UiArrayMemberList.
Task-number: QTBUG-82443
Change-Id: Ibdb3111b7721d2af087c14b79538dee131b8e301
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This allows us to enable testing on declarative for the module
as a whole and have some sort of test verification for the mean
time, and fix the fails over time.
Pick-to: 6.2 6.3
Task-number: QTBUG-100003
Task-number: QTBUG-100014
Task-number: QTBUG-100016
Task-number: QTBUG-100018
Task-number: QTBUG-100020
Task-number: QTBUG-100021
Task-number: QTBUG-100164
Task-number: QTBUG-100166
Task-number: QTBUG-100167
Task-number: QTBUG-100169
Task-number: QTBUG-100171
Task-number: QTBUG-100173
Task-number: QTBUG-100175
Task-number: QTBUG-100176
Task-number: QTBUG-100177
Task-number: QTBUG-100191
Task-number: QTBUG-100253
Task-number: QTBUG-100254
Task-number: QTBUG-100256
Task-number: QTBUG-100257
Task-number: QTBUG-100258
Change-Id: I85bf1501b94f04853a1ca715e35df0a56041308a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Do not expose this information to qmltypes just yet, though,
as this seems irrelevant at the moment
Pick-to: 6.3
Change-Id: Iffd8901ef9899a0fff226e8799bf45c1d688b92b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Disable tests that are meant to check debugging features using host
binaries. No point running those tests on actual targets.
Pick-to: 6.2 6.3
Change-Id: If020dfa00410668a305013254617fd50a0a01175
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Sub-process output is by default going to slog2 in
QNX so we need to force output to stderr instead.
1: FAIL! : tst_qqmlapplicationengine::application(delayed quit) 'QString(testStdErr).endsWith(QString(expectedStdErr))' returned FALSE. (
1: Expected ending:
1: qml: Start: delayedQuit.qml
1: qml: End
1:
1: Actual output:
Pick-to: 6.2 6.3
Task-number: QTBUG-76546
Change-Id: I4a7b6c25b079f7dcc479fc2bcbd3b079bd7bc519
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This test is so slow on QNX that it times out:
QFATAL : tst_QJSEngine::newQObjectRace() Test function timed out
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QGuiApplication(0x169b0a6b90),
parent's thread is QThread(0x37eb7070f0),
current thread is QThread(0x37eb734150)
FAIL! : tst_QJSEngine::newQObjectRace() Received a fatal error.
Task-number: QTBUG-99168
Change-Id: I623bff212b8334af60198e52bc283cc97187c3a7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
For QNX tests are run on qemu which is slow so the tests will always
timeout. As currently timeout is set to env via CMakeLists.txt it
does not have effect on QNX as that env variable is not passed over
SSH connection. Running tests on QNX qemu takes ~30min:
PASS : tst_EcmaScriptTests::cleanupTestCase()
Totals: 4 passed, 0 failed, 0 skipped, 0 blacklisted, 1782249ms
Pick-to: 6.2 6.3
Change-Id: Ief1ccb05ce21bf3140554272708c95ca5515bc23
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We register QList<T> as sequential container type for any value type T
we get. This way we can always find a type to use for list<t> with t
being a value type. The metatypes are shuffled around so that we have an
easier time associating a type with its list and vice versa.
As QQmlPropertyData's isQList flag denotes both QQmlListProperty<T> and
QList<T> now, we need to use QMetaType::IsQmlList more often.
Conversely, any name given to extra sequential containers registered via
QML_SEQUENTIAL_CONTAINER is explicitly ignored now. As you can do
list<foo> for any type foo now, there is not much of a point in having
further named container registrations for the same type. It would just
make things more complicated. Mind that the name had already been
ignored before, just not explicitly.
[ChangeLog][QtQml] You can now use lists of value types in QML. For
example a property of type list<int> will hold a list of integers.
Task-number: QTBUG-82443
Change-Id: I7bee61cee3963dae5d231bf59f70b8012984371d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Previously we warned about required properties that had a root level
alias. This pattern might be used to expose a nested required property
to the component's User though, so this change makes sure we do not warn
about the property being unset anymore.
Fixes: QTBUG-99693
Change-Id: I3ac7bcfe49b67ffb1b04373bd2770f465bd228f8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Remove usages of outdated LGPL3 header that references LICENSES.LGPLv3
instead of LICENSES.LGPL3.
See also 5d4679289b for a similar commit in the past.
Pick-to: 6.3
Change-Id: Icbe5eea7bb7b9c5d46cdd56fa3b177d2e22a5fa9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This way we make it consistent with qt_add_qml_module()
Fixes: QTBUG-100214
Pick-to: 6.3
Change-Id: I9f38a8ba3dec978ccdf4ea937ff662ae2449e582
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In theory, private properties could be supported in the compilers
through the QMetaProperty. Since we already know each C++ property's
index (and QML properties cannot be private), we can use that index
for a fast-ish QMetaProperty lookup. QMetaProperty itself has read and
write methods, which should be sufficient for all the use cases:
* read a value
* write a value
* create a binding
In fact, binding creation on non-grouped private properties is already
supported (or almost supported) since bindings already rely on
QMetaProperty information.
As a downside, QMetaProperty (even without name lookup) is still an
overkill compared to
static_cast<ClassPrivate *>(QObjectPrivate::get(this)) and then calling
READ/WRITE/etc. of a property directly
Task-number: QTBUG-91956
Change-Id: If77d2783ac161cb9bdd0bd9d0b397fe88e9c471d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We do not include things in QML, we import them. Also, the -i option
preferably imports from qmldir files, not from qmltypes.
Change-Id: Id4c5b3b774516526dfe80afa1c850bcccd6b2b4d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
You can now add your own, lower-case named, value types to your own
module, and use them in QML. Previously the names had been ignored, but
now you can actually declare properties using the value types.
The QtQuick value types are now handled exactly this way, and their
special casing at compile time is removed.
[ChangeLog][QML][Important Behavior Changes] You can now add your own
value types to QML modules. This works exactly like the registration of
object types, just with Q_GADGET instead of QObject/Q_OBJECT. In turn,
the QtQuick value types are only available from QtQuick now. Previously
you could declare unusable properties of QtQuick value types when only
importing QtQml. This is not possible anymore.
Task-number: QTBUG-82443
Change-Id: I5b2e867141244531cb13d789678fb7e06a6e41e7
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>