Commit Graph

3671 Commits

Author SHA1 Message Date
Ulf Hermann d3b3fef5a8 Qml: Allow const and non-const QObjectWrappers to coexist
We can access the same QObject in const and non-const contexts. Both
should be possible. Store the const objectwrapper in
m_multiplyWrappedObjects. That's somewhat slow, but const QObjects are
rather rare.

Pick-to: 6.4
Fixes: QTBUG-98479
Change-Id: I047afc121f5c29b955cd833e0a2c8299fc52b021
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-09-07 16:57:16 +02:00
Ulf Hermann 826b77c8cf V4: Account for the guard pages when allocating stack space
Previously we've assumed the whole allocation can be used, even though
the first and the last page are actually not usable. This makes a
difference when the size of the guard pages grows, such as on macOS,
which these days has 16k pages.

Add the extra guard page size to the amount of memory to be allocated in
order to fix the calculation.

Pick-to: 6.4 6.3 6.2 5.15
Fixes: QTBUG-93188
Change-Id: I0ebece94449da3127e9a78a19d8a22722ad8d698
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-09-07 16:56:42 +02:00
Sami Shalayel e0a00a6919 QQmlVMEMetaObjectEndpoint: ensure property cache before accessing it
Otherwise the property cache might be null and lead to segmentation
faults, e.g. when declaring aliases in qml.

Fixes: QTBUG-106256
Change-Id: I568c973e1ba00531fbe22a41e2c6c3c09dfc2f02
Pick-to: 6.2 6.3 6.4 5.15
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-09-07 09:58:00 +00:00
Volker Hilsheimer 14e8001e2f Fix cmake warnings from using deprecated PUBLIC_LIBRARIES
Pick-to: 6.4
Change-Id: I95ceed80b00db545d8f335e3c2ae35c077880717
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-06 22:18:52 +02:00
Sami Shalayel 70e6d671bc tst_qqmljsscope: remove Q_SKIP in qualifiedName test
The test has been fixed for some time now but the Q_SKIP() was not
removed yet (I guess the merge algorithm decided to keep both the Q_SKIP
and the improved test).

Amends d26675105b.

Change-Id: I6edd6fa1c3dca703f26adb8854155681f3872e5b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-09-05 14:52:25 +02:00
Fabian Kosmale 84483bff4f Engine: Fix handling of attached objects in function calls
When we use an attached object as an argument to a function call, we
need to properly extract it from the QmlTypeWrapper. Before this change,
we simpley left the argument pointer as null, which lead to subsequent
crashes when it got dereferenced.

Moreover, treat passing namespaces to functions expecting a QObject as a
TypeError, by returning false from CallArgument::fromValue (used to
crash for the same reason as with the attached object case).

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-106119
Change-Id: Ifa6a32e20a29935aff1f265eb0edd3e35ea1c11b
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-09-02 20:43:08 +02:00
Ulf Hermann b297e8fccf QML: Make modules imported with registerModule() available in QML
So far, you could only use them from pure JavaScript programs. Also, fix
re-exporting parts of native modules.

Fixes: QTBUG-105901
Change-Id: I170017083284e6457b1aa0c6e606fd26227edae3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-09-02 15:33:31 +02:00
Sami Shalayel d9add5c2d4 qmltc: test support for generalized group properties
Test support for generalized group properties in qmltc.

Also, force group property bindings to be deferred when they belong to a
generalized grouped property, while "not-generalized" grouped properties
never are deferred.

Fixes: QTBUG-105378
Change-Id: Iadc64d7033f9446ccf53e305d8831c7d348f257c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-09-01 22:12:32 +02:00
Fabian Kosmale 2879c7c341 Integrate property binding evaluation fix from qtbase
This is basically the same as QTBUG-105204, only with the QML engine
being involved.

Fixes: QTBUG-104982
Pick-to: 6.4 6.3 6.2
Change-Id: I5afaadedcd7af41198702a8f2331703b4f6ef2e7
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-09-01 22:12:32 +02:00
Sami Shalayel 3ebbc684ee Print assert messages in tst_ecmascripttests
Up to now, just the test result (pass or fail) was saved during testing.
Add an errorMessage in the test result that is retrieved from the
engine and print it out when a test is failling.

Fixes: QTBUG-106096
Change-Id: I73f9f7daaa92a942d89391043682d8d9ebbcdfa3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-09-01 14:27:00 +02:00
Fabian Kosmale 58e751de88 Disable qmllint's deferred property check
This mirrors 9d22088d93, which removed the
warning from the engine.

Pick-to: 6.4
Task-number: QTBUG-106069
Change-Id: Ib714bfbd251dcf30becd920c85ac65aceab43707
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-31 13:09:32 +02:00
Sami Shalayel 8120ec1d3d qmltc: test alias on properties with attributes
Add tests to qmltc to see if it behaves well for aliases to different
kinds of properties, and compares if the engine shares the same
behavior. Same for the attributes in the QMetaProperties.

Changes:
* add some more MOC information to aliases
** always add NOTIFY to aliases (like the engine does)
** always set DESIGNABLE to false for aliases (like the engine does)
** always set CONSTANT to false for aliases (like the engine does)
** always set STORED to false for aliases (like the engine does)

Test if:
* default aliases works when compiled via qmltc
* attributes of aliases are set correctly in QMetaProperty and compare
  it to the attributes of the QMetaProperty obtained from the engine.
* aliases can read/written/reset/notified

Fixes: QTBUG-105708
Change-Id: I66b9c43c8c8de3dbd2b33d5ce15cd42ffb377ce7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-31 09:33:02 +02:00
Ulf Hermann b6463590fa V4: Fix index calculations in String prototype
We generally have to do those calculations in double as we must not
collapse inf into 0.

Task-number: QTBUG-100242
Change-Id: Iaf8082160a1ab25060c131ee1a5fa259bbd31214
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-31 09:33:02 +02:00
Fawzi Mohamed d1f70a5326 qqmljslexer: add dump to qDebug
Change-Id: I8ce66f5d7a75ae8ba8733ddb464c2198bd18ce27
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-30 18:53:01 +02:00
Ulf Hermann 0a8fe228f6 QmlCompiler: Prevent lookup of value type where we need an object type
With a particular nefarious combination of Q_GADGET and inheritance from
QObject you can make QmlCompiler believe a type is a value type even
though it is actually an object type. We never want to touch such a
thing.

There was a safe guard against this when looking up the type from the
scope, but by putting it in a type namespace you could circumvent it.
Refactor the code to apply to both cases the same way.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-104556
Fixes: QTBUG-105608
Change-Id: I8a690e2b6f78fcaba0911a93504cde0d2c7dde0d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-30 18:53:01 +02:00
Ulf Hermann b50d01891b Parser: Preserve keywordiness of "static" across nested classes
"static" is a keyword in the context of JS classes, no matter how deeply
nested. Therefore, keep track of the nesting level.

Switching the keywordiness of "static" off during method definition
parsing makes no sense as the standard doesn't mention such a thing.
Method bodies are strict code where you cannot use "static" as
identifier. Methods and properties can be called "static" no matter if
static is a keyword or not.

Pick-to: 6.4
Fixes: QTBUG-96631
Change-Id: Ia09e52fe2ae72721fe1c8a9b95899a31095db988
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-30 18:53:01 +02:00
Ulf Hermann f4577447a1 QmlCompiler: Implement remaining operators
Some of the math operators were still missing. Add them and test them
all.

Since the "runInterpreted()" test function takes too long now, split the
qmlcppcodegen test in two: One that runs in compiled mode and one that
runs in interpreted mode.

Fixes: QTBUG-105188
Change-Id: I4b641d5e51b5a7e2a9254be40f257d7b249deb13
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-29 13:21:06 +02:00
Ulf Hermann cad5c89a0f QmlModels: Fix enum resolution in ListElement
There were two problems:
a, We need to allow recursion when querying for enums. Otherwise we
   cannot find enums in the same document.
b, when the enum resolution is done in the validation phase, we cannot
   query the current document's QQmlType for enums, yet, as it's not
   finalized. However, the QQmlPropertyValidator has the
   QQmlPropertyCache we're looking for in that case.
c, As a drive-by, fix the excessive conversions between QByteArray and
   QString.

Pick-to: 6.4
Fixes: QTBUG-95864
Change-Id: If0d2687986e1483a27ce11373a204235b92a6efd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-29 13:20:53 +02:00
Ulf Hermann cc89f62851 qmllint: Don't warn about access to attached enums
You can always access enums of attached objects, no matter what other
rules apply to the attached properties.

Pick-to: 6.4
Fixes: QTBUG-105590
Change-Id: I07878d8efe63468539168aa2c2842e3159ed2090
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-29 13:20:28 +02:00
Ivan Solovev a83f4bc19d Tests: do not use QT_DISABLE_DEPRECATED_BEFORE
For several reasons:
* It was renamed to QT_DISABLE_DEPRECATED_UP_TO
* Its value will be propagated from the general Qt build

Task-number: QTBUG-104858
Change-Id: I90c92dc05b884f6408467c573181c00f8e00e6b3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-26 12:49:40 +02:00
Ivan Solovev 4089ce1bc5 QML tests: port away from deprecated QLocale::nativeCountryName()
... and use nativeTerritoryName() instead.
This allows to build the tests without deprecated APIs.

Task-number: QTBUG-104858
Change-Id: Ia66f2e05fd033e1ca6da93b58dbcbccae3448ec5
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-08-26 12:49:33 +02:00
Ivan Solovev 7e149a310d tst_qqmlengine: guard the usage of deprecated APIs
Protect the usage of deprecated APIs by #ifdefery, and
also suppress the deprecation warnings for it.
This allows to build the tests without deprecated APIs.

Task-number: QTBUG-104858
Change-Id: Ied0aecc3fdf07db436ac11e70d0fa78e6a96dc1d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-26 12:49:29 +02:00
Benjamin Terrier b201b1d0b3 Fix error when calling byteLength on detached ArrayBuffer
ArrayBuffer constructed from en empty QByteArray are detached,
calling byteLength should not throw an error.

According to ECMA specifications the `byteLength` property
of a detached ArrayBuffer should retrurn 0.

See https://tc39.es/ecma262/multipage/structured-data.html#sec-get-arraybuffer.prototype.bytelength

[ChangeLog][QtQml][Important Behavior Changes] ArrayBuffer.byteLength()
now returns 0 on detached ArrayBuffers, conforming to ECMAScript 2021.

Fixes: QTBUG-103925
Change-Id: Ib1c325eff25459980e10a1f3cd9fb7cb3b8eb5e5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-25 23:57:11 +00:00
Sami Shalayel 75769767ac qmltc: translation binding support
Implement and test support for translation bindings in qmltc:
* qsTr()
* QT_TR_NOOP()
* qsTrId()
* QT_TRID_NOOP()

Not compiled by qmltc, but instead interpreted as script bindings:
* combinations like qsTr(qsTr())
* qsTranslate() (as in qmlsc)
* QT_TRANSLATE_NOOP() (as in qmlsc)

Add the *.qm files directly to the resources as qt_add_translations() is
not available from qtdeclarative (the cmake function lives in qttools that
depends on qtdeclarative).

Fixes: QTBUG-104637
Task-Id: QTBUG-105346
Change-Id: Ia9433c2bcef01f3486358d963059d9779c67708c
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-25 11:35:57 +02:00
Fawzi Mohamed af6e7348a8 qml: make lexer line by line & restartable
The Qml lexer was not restartable, make it so that a line can be
parsed independently from another.
This is a requirement for efficient indenting and highlighting.
Old approach in creator used a separate finite state machien "scanner",
now it is possible to use the same lexer as the parser.
One can "checkpoint" every few lines, and restart the process form the
line above the change, and stop when the status is the same as before.

Change-Id: I72a13a767ac7adfe103e56e60902e61c88e4fd82
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
2022-08-18 13:15:05 +02:00
Sami Shalayel 6fd035499c Blacklist tst_qqmlnotifier::deleteFromHandler
This test fails the dependency update on macos x86_64 platforms
but is just checking if/when a qFatal error is thrown. Therefore, it
is blacklisted.

Change-Id: Ie08c24e0b00aedbcf40b5b51191a0e4a6180a1dd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-12 12:42:34 +02:00
Fabian Kosmale 84dd339e2e qmlformat: Preserve variable declaration scope type
If the user used for(let x;...) we need to preserve the let and must not
change it to var.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-105361
Change-Id: I49fc3797505b569cc9b8a9138dd57ec7e70d3eb9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-11 08:46:05 +02:00
Ulf Hermann af1ef35fa0 JSON: Properly handle bad objects in JSON.stringify()
For objects with circular structures we generate a proper error message
and fail earlier. For objects with excessive recursion we throw a range
error rather than crashing.

This behavior is modeled after node's behavior in such circumstances.

We use the existing stack overflow detection to determine when to throw
the range error. Testing shows that on windows the limit was
insufficient. Lower it.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-92192
Change-Id: I25dd302f65f359111e42492df3c71549c4ed7157
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-07 18:08:49 +00:00
Sami Shalayel 9a509f2733 qmltyperegistrar: test warnings about duplicate exports
test that warnings are emitted for duplicate exports. Also, added
missing dependency in CMake for tst_qmltyperegistrar.

Fixes: QTBUG-103189
Change-Id: I7e26cd0de2f9a404c7c02822baef6eafa4f51c11
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-05 13:03:34 +02:00
Thiago Macieira 1b1d0e0c15 tst_QmlCppCodegen: don't use QGenericArgument directly
Just create a dummy type that has the actual name. To make that
possible, export the property cache creator's class counter to the
autotests – otherwise, we cannot know the name of the actual type, as it
would depend on the order in which the tests run.

Change-Id: I36b24183fbd041179f2ffffd17026b224c9737fa
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-04 19:10:09 +02:00
Ulf Hermann 59ccd01b7e Revert accidental change to test262
Amends commit 0dc4fd240a.

Pick-to: 6.4
Change-Id: I8b74645becdfa91402f49156f77799dc5dd8ec5c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-04 12:41:17 +02:00
Ulf Hermann fed5b07980 Qml: Don't crash on nested group properties with aliases
This fixes an oversight where in case of half-resolved grouped
properties we would forget to add the bindings to the "pending" list.
In addition we would fail to resolve their property caches later on.

Pick-to: 5.15 6.2 6.3 6.4
Fixes: QTBUG-94983
Change-Id: I88bd0ce56464438d2a105e5ed426e002495cc016
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-03 22:29:30 +02:00
Ulf Hermann b184d02648 QmlCompiler: Allow any conversion possible via QJSPrimitiveValue
All of those are legal in ECMAScript, and so we need to support them in
script bindings. As we have stricter rules for literal bindings, add an
extra method there to check for what QQmlPropertyValidator does.

Pick-to: 6.4
Fixes: QTBUG-105252
Task-number: QTBUG-105188
Change-Id: I0621b2c3aa196414f669873e93670557284a8bca
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-03 08:32:50 +02:00
Ulf Hermann 0b9fa18dfe V4: Mark InternalClass parents when running GC
We need to preserve them as they notify us about protoId related
changes. In order to avoid wasting heap space in case many properties
are added and removed from the same object, we put a mechanism in place
to rebuild the InternalClass hierarchy if many redundant transitions are
detected.

Amends commit 69d76d59ce.

Pick-to: 5.15 6.2 6.3 6.4
Fixes: QTBUG-91687
Task-number: QTBUG-58559
Change-Id: I3238931b5919ed2b98059e0b7f928334284ce7bf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-03 08:32:33 +02:00
Ulf Hermann d8db6e9484 V4: Fix exponentiation operator
We need to use the same algorithm as for Math.pow(...). Since we have
jsExponentiate() now, we can use it in all those places. The strange AIX
special case is definitely not useful anymore.

Task-number: QTBUG-105188
Change-Id: I43a251c71f1b547ad36855ac197080bfea8c94e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-03 08:19:54 +02:00
Andrei Golubev f11ad705e0 qmltc: Support CONSTANT and RESET property attributes in aliases
As a drive by, propagate CONSTANT attribute through the .qmltypes file
and qmlcompiler library

Task-number: QTBUG-91956
Change-Id: I5802fa29ddedcdadae3e505efca0c4fb4d6b2593
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-07-29 13:24:49 +00:00
Andrei Golubev 12ce728259 qmltc: Make explicit component ids accessible during object creation
Explicit components could be accessed by id like regular objects. Make
this work in qmltc by revisiting the object creation procedure - store
explicit components along with pure QML types in
QQmltcObjectCreationBase:

xxxxxxxx x'x'x'x'x'|yyyyy...
^        ^          ^
pure     explicit   types from base class
types    components

As a drive by, fix unset required property in one test file and add a
bunch of other test files to the initTestCase() check

Pick-to: 6.4
Change-Id: Ibdaa430d692c81101853f51dae1da462a57a9980
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-28 14:58:43 +02:00
Alexandru Croitor a8431a4067 CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers
Change-Id: I1cd769f85d5f82c43639d6787d98e536619249e6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-28 14:58:42 +02:00
Maximilian Goldstein c16570ea56 qmllint: Make unused import warning less redundant
There's no reason to have the location in the warning.
It already gets printed by the logger.

Change-Id: Ia1335cab6324587a4e35a25bbb46537f358e1bd7
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-07-28 11:10:12 +02:00
Andrei Golubev e14b7fe597 qmltc: Fix alias assignment code generation
Fix subtle issue where alias assignment would cause qmltc to generate
direct property set code (doesn't work for aliases since those do not
have "real" properties)

Remove now redundant TODO and identical code path when compiling alias
assignments on types with composite bases (used to work poorly during
prototype times)

Pick-to: 6.4
Change-Id: Ifacf5872ff5432a748fb1ec16c300ec844d65e9a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-07-27 17:16:56 +02:00
Andrei Golubev 2d5f3eb86e Support RegExpLiteral bindings in qmltc
Task-number: QTBUG-91956
Pick-to: 6.4
Change-Id: I02f8c6d1f0d6e4411985ffe3f22fb3c51fb36db6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-27 11:54:48 +02:00
Fabian Kosmale 9bcd137da0 Avoid target name conflict
The qmlqtimeexampleplugin exists as a target name both in examples and
in a test; rename the one from the test.

Change-Id: I21b68f7d6228ceaee49ba28e55516b5b10ffce3a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-07-27 00:31:42 +02:00
Ulf Hermann 6ea2a1cdb7 QQmlListAccessor: Accept QQmlListProperty
So far we have only accepted QQmlListReference. However, we can also
pass a QQmlListProperty around as value.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-105137
Change-Id: I7d4cd3048b62594298f91013c4cda5ec864a28df
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-07-26 21:17:28 +02:00
Andrei Golubev 38d9bf60ba qmltc: Fix import namespace code generation
Fix subtle issue where an import namespace would become part of the
generated C++ class name without modifications (so with '.'). Preserve
the namespace for the time being just to make the generated code more
verbose (e.g. consider mixing QQ.Text and ZZ.Text in the same file)

Change-Id: I3d409988ae136c272aac6a4eab287a7221f88450
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-26 10:34:49 +02:00
Andrei Golubev 1453650419 qmltc: Acknowledge BINDABLE-only properties
Task-number: QTBUG-91956
Change-Id: I4c34ccd9d6d5cf4c6a6c1b54e67374515e67861a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-26 10:34:49 +02:00
Andrei Golubev ca68b0cde7 qmltc: Use QMetaObject hierarchy as reference for meta index calculation
qmltc needs to compute a QMetaProperty index ahead of time when creating
property bindings. This procedure has to acknowledge that extensions
exist

Change-Id: I7bf6b6c558ce78e0fec5ee880bc4d39a79fe5640
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-26 10:34:49 +02:00
Ulf Hermann 00e95e3506 V4: Allow conversion from string to QByteArray when setting bindables
We allow it everywhere else, too.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-105044
Change-Id: I714e5d501a780310791523c5f35a87681c69b1fb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-25 20:31:21 +00:00
Ulf Hermann aa553318d4 Fix precedence between JS and QML scopes
In case of a JS context, we need to do the JS lookup early in order to
override imports with locally defined functions.

[ChangeLog][QtQml][Important Behavior Changes] The precedence between
imports and locally defined functions and variables in JavaScript files
has been fixed. If you import a JavaScript file from a QML file, the
functions inside the JavaScript file should obviously override anything
imported from the QML context. This behavior has been restored.

Pick-to: 6.4
Task-number: QTBUG-91687
Change-Id: I119e3109f96ffad7455daaf1a5f17bad31fa8e33
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-07-25 12:26:07 +02:00
Maximilian Goldstein 34d52f8b2c qmllint: Implement module linting
This change allows for modules to be linted via the -M flag.
This will check whether an individual module has a sound qmldir and
qmltypes. It will also verify whether all its types and the types of
properties can be resolved.

It does not lint individual QML files.

[ChangeLog][qmllint][New Feature] Individual modules can now be linted
via the -M option

Fixes: QTBUG-103264
Change-Id: I3ced4b0bc05358e9216c9819f1dca67af909405e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-07-25 12:26:06 +02:00
Andrei Golubev 2f4935289e qmltc: Acknowledge group/attached properties have objects in QmlIR
Group and attached properties have QmlIR::Objects associated with them.
However, qmltc's object index calculation ignores groups/attached types.
Fix this, making object index calculation aligned for implicit
components

Fixes: QTBUG-104780
Pick-to: 6.4
Change-Id: I377d3eab714d0e9618ac2ef84c2738b45ad3b6cc
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-25 12:26:06 +02:00