Commit Graph

3536 Commits

Author SHA1 Message Date
Ulf Hermann 8e69558f2f qmltyperegistrar: Parse value type lists
We need to generate isList properties for those, so that qmlcachegen and
qmllint can handle them.

Pick-to: 6.4
Fixes: QTBUG-104129
Change-Id: I7e632279a605694c2fd5f583c8a6dcf9968eb634
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
2022-06-10 14:41:32 +02:00
Andrei Golubev d28f088371 Remember QML document context in each qmltc-generated object
There is an apparent problem in certain cases where using outer context
to fetch ids is invalid: the outer context is the *outermost* context,
meaning that if a type has a derived type in another QML document,
the derived type would place its own context as a QQmlData::outerContext

As a simpler solution, just remember the document's context in all the
objects within this document. This automatically works in derived types
since they appear in other documents with separate contexts

Pick-to: 6.4
Fixes: QTBUG-103956
Change-Id: I29420ff4962b485502d87b2d2ac2f89b9e0f5736
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2022-06-09 16:22:22 +02:00
Andrei Golubev bf7aaeda87 qmltc: Move from QmlIR::Binding to QQmlJSMetaPropertyBinding
This symbolizes the last piece of QmlIR dependency that qmltc has.
We do still have some implicit dependencies on QmlIR, though, but
that should go way once the remaining prototype code's logic is
migrated to QmltcVisitor, QQmlJSScope and friends. This, however,
is not attempted here as the patch itself is rather large

In the process of switching to QQmlJSMetaPropertyBinding, observe
and fix issues in QmltcVisitor and surroundings

Pick-to: 6.4
Change-Id: I752b68a7f57baf354de16dc0bb466a3f693a4e49
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
2022-06-09 09:12:28 +02:00
Andrei Golubev 99178a947c QmlCompiler: Fix script indices calculation
The logic is misbehaving on multiple occasions. For instance,
same-named signal handlers in different scopes and script bindings
inside array scopes were wrongly handled. Fix that by revising
the mechanism of inner function computation

As a drive by, fix parseLiteralOrScriptBinding() to distinguish
translation bindings from script bindings (they are vitally
different now)

Extend the script calculation test in tst_qqmljsscope to cover
the findings

Pick-to: 6.4
Change-Id: Ic4cf0a4539f0d714a416b61f4635eb6494e89922
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
2022-06-09 09:12:14 +02:00
Andrei Golubev 6ced46e422 Rename tst_qmltc_{no}diskcache data folder to QmltcTests
Follow the policy of "good" QML modules where the module would reside
in a folder named the same way as the module URI

Somehow this is still not enough to remove an explicit
"-i <own qmldir>" workaround in qmltc compilation command

Change-Id: If1725ec03baf3690bb6cb8fc7876b082a155eaa2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-03 08:46:10 +02:00
Ulf Hermann 8ea9646019 QmlCompiler: Don't crash when trying to resolve null list types
If the element type is unknown the list type is also unknown. This will
happen if we cannot resolve the type.

Fixes: QTBUG-103920
Change-Id: If1b05d99a1e64961981b5adb3974a51c11e776d2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-02 10:07:40 +02:00
Andrei Golubev e5251efe97 Set bindings on QQmlJSScope after AST traversal
We can get into situations when binding creation is problematic
due to the relevant scopes being yet unresolved. In particular,
this happens when processing attached/group properties script
bindings

Avoid having this situation by postponing the actual binding
setting until after the relavant scopes are resolved (mainly,
the binding owner). However, do relevant AST order dependent
operations beforehand to avoid accidental errors

This commit amends 25098b7a4f

Fixes: QTBUG-103897
Change-Id: I671955dbe321d03e5f1ab9891cc79dc0a936deda
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 10:07:40 +02:00
Andrei Golubev 87053c5422 Inherit base type access semantics in QQmlJSScopes
Group scopes may be value types so they require access semantics
different from a default value

Ordinary scopes and attached scopes seem unaffected, only groups
are thus covered with an extra logic

Change-Id: Ia9012548a602ca7ca07296491d27a295f4455f91
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 10:07:40 +02:00
Andrei Golubev 26179e6937 Address extension types in qmltc
Whenever working with properties (reading, writing, aliasing, etc.)
of the type that has extensions, prefer the same-named properties
from extension objects over type-owned properties (this is the internal
QML mechanism)

To achieve that, we need to query the extension object:
* for Q_GADGETs use a dummy model of assuming we can cast the object
  to the extension type and use that
* for Q_OBJECTs use a qmlExtendedObject() with additional logic of
  figuring out which extension should be picked in each specific case

Create QQmlProxyMetaObject via a custom dynamic meta object API for
qmltc-compiled objects that are derived from base types with
extensions

Task-number: QTBUG-91956
Change-Id: I5e783768ae2abdb9dddf894de7e79960244352bd
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 10:07:39 +02:00
Andrei Golubev b85ac05e4a Document that QML_EXTENDED properties are practically FINAL
This is de-facto how it always was before
ff0b9ec6bf. As we plan to revert back to
the "original" behavior, document the FINALity of the properties so that
users know how it behaves (and we could not be held responsible for this
mess)

Change-Id: I4afed215fd66875821b7ce8d824b81782388324b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 10:07:39 +02:00
Andrei Golubev e353639d63 tst_qqmllanguage: Test extended group property case
Task-number: QTBUG-103881
Change-Id: Id5e0925f479ee638cc4db7fad18cc6d951b07f98
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 10:07:39 +02:00
Ulf Hermann e3e8008ec3 Allow retrieval of sequences from QJSValue
As we can store sequence types in QJSValue, we should be able to
retrieve them, too.

Move the declaration of the QV4::Sequence struct into a header to make
it less of a hassle to identify sequences.

Change-Id: I3e45bfe193c669107f90cd6c502765c0c9f60fb0
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-06-02 02:42:51 +02:00
Andrei Golubev 86fae5664c Remove qmltc compilation command in favor of qt_add_qml_module()
[ChangeLog][CMake] The qmltc compilation functionality provided by
qt6_target_compile_qml_to_cpp() is merged into qt6_add_qml_module()
command and is available through ENABLE_TYPE_COMPILER argument. The
qt6_target_compile_qml_to_cpp() function does nothing and is left
only to highlight that users must migrate away from it.

Fixes: QTBUG-100215
Change-Id: Ie7d6b82564dff86176194fce35039ba0d93c0977
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-05-31 17:23:09 +02:00
Jani Heikkinen 6f9fbc8fef Revert "Revise QQmlProxyMetaObject and extension chain creation"
This reverts commit ff0b9ec6bf.

Reason for revert: QTBUG-103881

Change-Id: I7e333ec854e81fb06f1f84b77125edc78bb181e6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-31 11:09:22 +00:00
Ulf Hermann 29e2c7b414 QQmlDebugProcess: Crash if we cannot kill the debuggee
If the debuggee somehow manages to ignore our kill signal, the QProcess
dtor will hang. Let's rather crash in this case, so that we see when it
happens.

Task-number: QTBUG-101678
Change-Id: Idc72412925244acfdb1dfdeec07369d5fb271080
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-31 12:55:00 +02:00
Ulf Hermann f5514e682b QtQml: Fix and test edge cases of QQmlFile's local file detection
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>
2022-05-31 12:54:49 +02:00
Ulf Hermann 6ff6c088c2 QmlCompiler: Add support for LoadElement on strings
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>
2022-05-24 15:44:16 +02:00
Ulf Hermann a75ddda71b QmlCompiler: Implement LoadElement for value type lists
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>
2022-05-24 15:44:16 +02:00
Maximilian Goldstein 3d8702378b tst_qmllint: Write clearer descriptions when unexpected output is found
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>
2022-05-24 15:44:16 +02:00
Ulf Hermann 4d71091a19 qmlcompiler: Evaluate pragma ComponentBehavior
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>
2022-05-24 15:44:16 +02:00
Andrei Golubev ff0b9ec6bf Revise QQmlProxyMetaObject and extension chain creation
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>
2022-05-24 10:30:48 +02:00
Andrei Golubev c02dd17a4f Support extension property revisions
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>
2022-05-24 10:30:44 +02:00
Ulf Hermann 7fa03450cf QML: Add an option to bind components to files
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>
2022-05-23 12:50:02 +02:00
Andrei Golubev cfbc5ecf2a QML: Correctly detect extended types
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>
2022-05-23 12:50:02 +02:00
Sami Shalayel 69cd8c2779 qmlcompiler: Add qualified name to QQmlJSScope
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>
2022-05-23 12:50:02 +02:00
Maximilian Goldstein 827193b3a1 qqmljsimportvisitor: Fix assert being hit on empty block bindings
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>
2022-05-19 22:30:23 +02:00
Ulf Hermann 4a10e1d84a QmlCompiler: Detect non-integral values when accessing QQmlListProperty
Pick-to: 6.2 6.3
Fixes: QTBUG-103560
Change-Id: Ifcc73baf7f79e30f6e83ff3e500dd39f95790bfe
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2022-05-19 22:30:23 +02:00
Ulf Hermann 70da741404 QmlCompiler: Do not coerce value type lists to QQmlListProperty
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>
2022-05-18 19:40:58 +02:00
Maximilian Goldstein 8db0402e72 qmllint: Properly warn about missing required properties in delegates
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>
2022-05-17 16:38:17 +02:00
Ivan Solovev c9013be2d9 tst_qqmlqt: fix TimeZoneSwitch logic
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>
2022-05-17 16:38:17 +02:00
Maximilian Goldstein 2ebee301fd Reimplement PropertyPass to evaluate bindings
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>
2022-05-16 18:22:45 +02:00
Maximilian Goldstein 78483744b4 QmlLintQuickPlugin: Warn about various SwipeDelegate issues
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>
2022-05-12 17:36:12 +02:00
Andrei Golubev 5cd59bff0c Support querying indirect extensions for a given object
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>
2022-05-12 17:36:12 +02:00
Ulf Hermann d0c7c7234c Generalize role selection mechanism from QQuickComboBox
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>
2022-05-11 16:25:16 +02:00
Ulf Hermann 36ebee4e69 QML: Port QV4::CompiledData::Binding to new special integer bitfield
Pick-to: 5.15 6.2 6.3
Task-number: QTBUG-99545
Change-Id: I9f8bc5fa45c61f77ee95b055a3d8de001da8f8c5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-11 12:56:22 +02:00
Ulf Hermann cf9c0f0180 Avoid memory leaks in QQuickListView and tst_qqmlinstantiator
Pick-to: 6.2 6.3
Change-Id: Ieceffedb082e893b54bcda99076df3ccdeff6010
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-11 10:06:38 +02:00
Andrei Golubev b13a66f1c8 Distinguish extensions from extension namespaces in QmlCompiler library
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>
2022-05-09 16:50:07 +02:00
Andrei Golubev a287e862d4 Fix extension lookup in QQmlJSScope
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>
2022-05-09 16:50:07 +02:00
Ulf Hermann 2bed3d5f0f V4 Engine: Don't try to convert JS functions to other types
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>
2022-05-09 11:59:49 +02:00
Andreas Buhr 5049dcb268 Skip crashing tst_qqmlbinding::delayed() on Android
Pick-to: 6.2 6.3
Task-number: QTBUG-103310
Task-number: QTBUG-101865
Change-Id: I22454487f0bbb7e124a1e870ff936e7513748af9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-07 09:45:55 +02:00
Andrei Golubev ffe017b92c tst_qqmljsscope: Fix test module importing
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>
2022-05-04 22:34:15 +02:00
Andrei Golubev 6390cc5d24 QQmlJSImportVisitor: do not register group { ... } as an object scope
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>
2022-05-04 22:34:15 +02:00
Andrei Golubev 218eb5f571 QQmlProxyMetaObject: Ignore properties/methods of non-creatable proxies
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>
2022-05-04 22:34:15 +02:00
Andrei Golubev 74bcf29064 Add extra extension tests to tst_qqmllanguage
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>
2022-05-04 09:28:22 +02:00
Maximilian Goldstein ee30dd815e qmllint: Warn about invalid anchor combinations across components
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>
2022-05-03 15:25:11 +02:00
Andreas Buhr bdbab58de7 Skip crashing test in tst_qmlcppcodegen on Android
tst_QmlCppCodegen::scopeObjectDestruction() crashes on Android.
Skip this test for now.

Pick-to: 6.2 6.3
Task-number: QTBUG-103044
Task-number: QTBUG-101865
Change-Id: I1d6291decf946b954bffc2378255c209126106fd
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-05-03 15:25:11 +02:00
Andrei Golubev 2299031225 qmltc: Move alias compilation to qqmltccompiler
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>
2022-05-03 15:25:11 +02:00
Ulf Hermann 9dc3b0a06c tst_qqmltranslationservice: Fix order of UI languages
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>
2022-05-03 01:01:30 +02:00
Ulf Hermann 3a4b6b9ba2 tst_qqmldebugtranslationservice: Avoid memory leaks
Change-Id: Ib2b7a70fa015a298362cc56bb3da2819aeedd33c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-05-02 21:58:59 +02:00
Sona Kurazyan 2c9c1590e6 Replace uses of deprecated _qs with _s/QStringLiteral
Task-number: QTBUG-101408
Change-Id: Ic925751b73f52d8fa5add5cacc52d6dd6ea2dc27
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-04-29 09:47:43 +02:00