aboutsummaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* qmllint: Fix unknown properties on varMaximilian Goldstein2021-03-032-0/+10
| | | | | | | | | | | | Since the type of a var may change at runtime and we thus can't make any good predicitons on its actual underlying type we will ignore it from now on (as already done for variants). Fixes: QTBUG-84060 Change-Id: I36795ef2047629d3c870bf8a9df59dcd3db06633 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 25ae86d1d98dbf3900eefea152b072939be8ea71) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use the correct metaObject in captureProperty()Ulf Hermann2021-03-011-0/+73
| | | | | | | | QObject::staticMetaObject is not very useful. Change-Id: Ifc40e1fa08755c59ff6b8ae23a7a1257f34507da Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 89ebac46d7bde1df265b8970132bf09dc790eca2)
* Move event delivery from QQWindow to QQuickDeliveryAgentShawn Rutledge2021-02-254-16/+25
| | | | | | | | | | | | | | | | | | | | | | QQuickWindow owns QQuickRootItem which owns QQuickDeliveryAgent, so for every window there's an object responsible for event delivery, while the window itself is mainly responsible for rendering (separation of concerns). However, QQuickRootItem and QQuickDeliveryAgent can now be used in cases where the scene doesn't directly belong to a window, such as when a Qt Quick sub-scene is mapped somewhere into a Qt Quick 3D scene. In that case, we must remember which delivery agent was in use at the time when a QEventPoint is grabbed and deliver subsequent updates via the same DA. There's also a QQuickDeliveryAgent::Transform abstraction which subscene-management code (such as QQuick3DViewport) can implement, to provide a formula to map the window's scene coordinates to subscene coordinates; if defined, it will be used during delivery of subsequent updates to existing grabbers. Task-number: QTBUG-84870 Change-Id: I70b433f7ebb05d2e60214ff3192e05da0aa84a42 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 68c103225f4e8bd6c1b18ef547108fd60f398c0f) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtQuick.Shapes: Declare dependency on QtQuickUlf Hermann2021-02-242-0/+9
| | | | | | | | | | Otherwise qmllint and other tools won't know what QQuickItem is in this context. Change-Id: I68da08cf2c41f17a2623f30303ac8f66b7b9329a Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 1a4b0929de72d533c56dd38a9eaf49d21f16e197)
* qmllint: Support enum types from other scopesUlf Hermann2021-02-243-0/+7
| | | | | | | | | | | | In qmltypes, enum types can be scoped, just like in C++. Resolve those scopes. Also, resolve the enum scopes only once, in order not to duplicate the types. Change-Id: I095ec11f0ffec8e0e5f1034023c8956d2d39f660 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 75b99a10b3229c7ed14ded8622f3334c3cd02af5)
* qmllint: Check for existence of property typesUlf Hermann2021-02-244-0/+27
| | | | | | | | | | | | | | | | For each binding there should be a property and that property should have a type we recognize. Enums can be property types in C++. We support this by adding child scopes for such enums. The child scopes are then referenced by the QQmlJSMetaEnums and derive from int. The test then reveals that we were missing a few properties in QtQuick.tooling. Add those. Change-Id: I1deef94393ee0e17d34c2dc5980ebfbf25417f36 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 08c8e8ac3ba8eb23ae5c158990f5d029ac9988ed)
* Fix QJSValue singletons only supporting object typesMaximilian Goldstein2021-02-221-0/+42
| | | | | | | | | | | Now primitives such as integers and strings should also work. Fixes: QTBUG-85615 Change-Id: I201d1844b7272ca50e32f1e33e9ac357b5e68dfe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 64102ae231317eb6f637304918e55153dadef72d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmllint: Resolve attached property scopesUlf Hermann2021-02-193-0/+15
| | | | | | | | | Previously, all attached property scopes were just ignored. Task-number: QTBUG-84369 Change-Id: I324becf92402eacea9d150e6e51359edae562dde Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit f34ecc8f99522b69d1aaa3d5d233add9ed9b6da9)
* Layouts: Depend on QtQuickUlf Hermann2021-02-192-0/+8
| | | | | | | | | | | If we don't declare the dependency our tools won't figure out where QQuickItem comes from when analyzing the dependency hierarchy of layouts. Change-Id: I389c9e513a3a65143aa6b6fbf508eee584970181 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit fe7318a6cf4398802f919766f2ac585bd844cf48)
* qmllint: Fix false unknown grouped property warningMaximilian Goldstein2021-02-192-0/+8
| | | | | | | | | We seem to be checking grouped properties twice by endVisit(UiObjectBinding*) and endVisit(UiObjectDefinition*). So the UiObjectBinding variant is removed here as this gets run before all type information is available. Change-Id: Idfe23869792f787df6109cde3b6bc1d96cce3dc3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 4660f51f25a6c56182dff0ea24f7c1ad2bac9cea)
* qmllint: Fix segmentation faultMaximilian Goldstein2021-02-193-0/+22
| | | | | | Change-Id: Ie04ad4221b25628687c2575facf90488b83d21bf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 5fb34b67b810ca284c216009925f4f38220c4510)
* QQmlPropertyPrivate::signalExpression: handle object being nullFabian Kosmale2021-02-191-0/+10
| | | | | | | | | | | | | | | QQmlData::get expects a non-null pointer, therefore we need to check whether the object still exists. Note that while this fixes the crash in the referenced bug, PropertyChanges still does not support a dynamic target. Task-number: QTBUG-46350 Change-Id: Ifeecf5df83e87468a1d314ce2b120006124d6f4b Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 1ff376e64bf5af6df7e0079700d2b9164037dc89) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_qquickdesignersupport: skip crashing testsSamuli Piippo2021-02-193-7/+10
| | | | | | | | | | | Blacklisting doesn't work when the tests crash, use the emulation detection instead and skip tests. Task-number: QTBUG-90869 Change-Id: Icd9cff8b9d45edc2f97ae13acdf0e71ed44aa0e4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 77156cd98f3e29d9bd89df335bb172e59da43483) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QJSPrimitiveValue: Implement modulo operatorUlf Hermann2021-02-191-1/+5
| | | | | | | | | | | The modulo operator has special semantics in JavaScript. We need to mirror those. Task-number: QTBUG-84369 Change-Id: I5a4d63a01e232686832c83f2def0faf57e7359c2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 84cf29933cee44e09590fc89ae800dd453f664ca) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QJSValue: Allow casting integers to enumsUlf Hermann2021-02-192-0/+18
| | | | | | | | | You can also cast enums to integers, after all. Change-Id: I283d3dd280eeb44ba22bb45ca9be69e5358d5781 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 453be4e6065a323e7fc0ea93fa0bee845d2020cd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmllint: Don't create properties for "on" assignmentsUlf Hermann2021-02-162-0/+11
| | | | | | | | | | | "on" assignments are assignments to the default property, with the property given interpreted as the target for the inner object. Change-Id: Ia93a171f759964d2c00d6c0293a5434f588123af Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 67c8afff346eae27c6fb833661d179326dd8b153) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* qmllint: Warn about too many or mismatched signal parametersUlf Hermann2021-02-153-0/+33
| | | | | | | | | | | It's easy to mess this up when you transform your signal handlers into functions. Task-number: QTBUG-89943 Change-Id: If35be2f6828a0e19aada19abb41d8135b0c6ab45 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit f0ecad1e99461109e69cd2b0f6271012c20005dd) Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* MouseArea: fix containsMouse behavior during visibility changesVolker Hilsheimer2021-02-122-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQuickItem returns whether it contains QGuiApplicationPrivate's lastCursorPosition. Since that position stores the coordinate last seen by Qt (the window border), it will always be within the window, and within an item that covers that part of the window's border. However, QQuickWindow stores the lastMousePosition as well, and resets that value when it receives a QEvent::Leave. We can use that to test whether the window that contains the item has seen a Leave event, in which case the item is definitely not under the mouse. Notes on the test: That we use QPointF() as the "reset" value leave the small possibility that the cursor might be at position 0,0 of the window (ie inside the window), and the QQuickItem there will not be under the mouse. We can't confirm this (through an expected failure test), as QTest::mouseMove interprets a QPoint(0, 0) as "center of the window". And since we can't simulate mouse moves outside a window's boundary using QTest::mouseMove, the test needs to explicitly synthesize a QEvent::Leave for the window. Fixes: QTBUG-87197 Change-Id: I04870d6e914092275d9d790312fc702fb99f2935 Done-with: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit ba1246c543118515ea244787f3d7f9c1133ccf0f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QML: Warn about usage of injected signal parametersUlf Hermann2021-02-121-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | You should declare functions with formal parameters if you want to use parameters passed by the signal. We need to generate two different warnings because there are two code paths by which such parameters are injected. If we compile with qmlcachegen, it simply inserts a lookup instruction in to the byte code. This lookup then triggers our special hack expressly made for signal parameters. If we don't compile using qmlcachegen, a function declaration with formal parameters is synthesized. We mark those formal parameters as injected and warn if we see one of them used. [ChangeLog][QML][Important Behavior Changes] The automatic injection of signal parameters into signal handlers is deprecated. This is because we cannot determine the names of the signal parameters at compile time. Furthermore, also for human readers it is difficult to discern between arguments, context properties, properties of the current object, and properties of the root object of the component. Requiring the signal parameters to be explicitly named resolves some of this confusion. You can turn the deprecation warning off using the "qt.qml.compiler" and "qt.qml.context" logging categories. Task-number: QTBUG-89943 Change-Id: If0a5082adb735a73efd793868b3a55bc7d694cbe Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit df70d4f76f9c1c7b3de9ae91877df803c18b1264) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Replace QScopedPointer with std::unique_ptrVolker Hilsheimer2021-02-124-27/+27
| | | | | | | | | Fix compiler warning, QScopedPointer::take was deprecated in Qt 6.1. Change-Id: I67045bce97efb082b1b7467a6c24d5dbf996fdc1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 070072e7cabd6f4f26f4938b1616e56254ad25d9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QML: Warn about variables being used before their declarationUlf Hermann2021-02-122-0/+13
| | | | | | | | | | | | | | | | | | | This collides with injected signal parameters. qmlcachegen cannot tell those cases apart. [ChangeLog][QML][Important Behavior Changes] QML warns about JavaScript variables being used before their declaration now. This is almost always a mistake. It is particularly dangerous in the presence of injected signal parameters because qmlcachegen cannot identify a name collision between an injected signal parameter and a variable being used before its declaration. It therefore miscompiles such code. You can turn off the deprecation warning using the "qt.qml.compiler" logging category. Task-number: QTBUG-89943 Change-Id: I8a9424ca8c6edd562402fe5c560ba7e8344b5585 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit ab71cdafca87513a4e214d3af056d8990bc1eddb) Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Fix QJSValue string parameters used in signalsMaximilian Goldstein2021-02-102-0/+32
| | | | | | | | Fixes: QTBUG-86482 Change-Id: If938fad22f51b08fe3cb20b94634efe46a1eed47 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit e887f25dd6c4c9630a7367c3a2ed95a284191843) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make tst_qmldiskcache::regenerateAfterChange() pass on big endian systemsDmitry Shachnev2021-02-091-3/+2
| | | | | | | | | | | | | | We cannot use reinterpret_cast here, because testUnit->constants() returns a pointer to quint64_le data, which needs to be converted to native endianness first. Here I used the QV4::Value converter that accepts quint64, so this conversion now happens implicitly. Change-Id: Iff6e3e4554af8890e61cb06e6fd79339c7a14653 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit dab0d62b655ce9a476993de2558a573a5066288c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Return errors if validation of inline components failsUlf Hermann2021-02-081-0/+17
| | | | | | | | Fixes: QTBUG-90038 Change-Id: Ic01b5d097e0b9e6720bcec7ccb18c22abb5418f4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 001596d472557bca08eb93159e724301dea88ad6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickItemParticle give() method kill particleFabio Falsini2021-02-052-1/+6
| | | | | | | | | | | | | | | Currently removing an item connected to a particle only invalidate the particle that will be reused for the next item set. This has the effect that the new item inserted appears in the same position as the old one just removed. This patch force killing the particle to assign next item to a new particle starting from initial position. Change-Id: Ic937a6d7aea65368cceb1405bb81ef1502d988a5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit d0b1bef8b889ab852eaf906fdc9cd4219238872e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSequentialAnimationGroupJob: Protect against self-deletionUlf Hermann2021-02-051-1/+41
| | | | | | | | | | | | setCurrentAnimation() can indirectly delete the animation group job itself by invoking the animation controller. Use the RETURN_IF_DELETED mechanism to avoid the resulting dangling pointers. Task-number: QTBUG-90401 Change-Id: Ibd0ad21e8d3af4760604c3ff37dc46101d5f49ad Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 680f28b08f65ad38c8d5498b5738231b2a2779a3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_qquickitemlayer: skip tests when running on offscreen platformSamuli Piippo2021-02-051-12/+40
| | | | | | | | | | More tests fail on offscreen platform when tested on QEMU on CI. Task-number: QTBUG-63185 Change-Id: I293e9b32078bf2567fbb9773cedf6777ad182a69 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 34477bdbb00b351fe254fc42155e876d06b0c994) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_qquickdesignersupport: blacklist tests that segfault on QEMUSamuli Piippo2021-02-051-0/+7
| | | | | | | | Task-number: QTBUG-90869 Change-Id: I70abb1baa2b919880bc711ee00d5fdbaef69301d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 1e8cb40d24402c9d0b6290cc251244ba0ec882d4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQmlIRLoader: Actually load RequiredPropertyExtraDataFabian Kosmale2021-02-032-0/+17
| | | | | | | | | | | | | | | If a QML component wants to mark properties of its "parent" component as required, it can do so via required propertyName The information about those properties is stored in a RequiredPropertyExtraData data structure. This structure is already serialized to disk in the QQmlIRWriter. However, we neglected to restore it so far in the loader. Fixes: QTBUG-90538 Pick-to: 5.15 6.0 Change-Id: I789daff9bc881e4f35c942c77f5116b5284de81b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmltyperegistrar: Fix handling of default propertiesUlf Hermann2021-02-022-0/+85
| | | | | | | | | Default properties are always local. There is no way to declare a default property for a foreign type as the default property is queried directly from the classinfo at runtime. Change-Id: I30efb6fba190957ac2a4ad86da437f209cd1f3ad Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Make the internals of QQuickAnimatorController privateUlf Hermann2021-02-021-0/+4
| | | | | | | | | | No one should mess with those. All the pointers have complicated ownership semantics. We can just befriend the test instead of making it all public. Task-number: QTBUG-90401 Change-Id: I6c4adbab7046b40db7f4628780ef928445ea3eb2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Do not add extensions to local anonymous typesUlf Hermann2021-02-021-1/+1
| | | | | | | | | If we generate a local anonymous type, then that's the local part of a QML_FOREIGN local/foreign couple. Any QML.Extended in there belong to the foreign type. Change-Id: Ic1706045eff03dd7b1b553240596ffc21818c8bd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QuickTest: Do not recurse forever on inline components in enumerateTestCasesFabian Kosmale2021-02-015-0/+128
| | | | | | | | | | | | | | | | | | | | In TestCaseCollector::enumerateTestCases, we visit the super compilation unit of QML tpyes to check if they might be instances of TestCase. However, in the case of inline components, the super unit is the current compilation unit, and we would recurse endlessly. This does not address the issue that an inline component might actually inherit TestCase. However, as this only affects the enumeration output and does not actually affect test execution, this is not that much of an issue. It should also be noted that the enumeration also fails in any case where TestCases are loaded dynamically (with a loader), so the method is not 100% accurate even in the absence of inline components. Fixes: QTBUG-90740 Task-number: QTBUG-90762 Pick-to: 5.15 6.0 Change-Id: I7e133d62c4f62fc46e9bd3999ff755f7ded3c386 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QmlCompiler: Allow for multiple extensions per objectUlf Hermann2021-02-018-0/+189
| | | | | | | | | | | | | | | | | | | Previously, the assumption was that each object could only have a single extension object. As proven by the new qqmllanguage test this is not the case. Each registered object in the type hierarchy can have its own extension. Therefore, adjust the algorithms that generate qmltypes and iterate the extension objects when analyzing them. This leads us to the realization that anonymous types can in fact meaningfully carry extensions and implement interfaces. Adapt qmltyperegistrar accordingly. For the test to compile, however, we need to realize that the class declaring interfaces needs to befriend all potential subclass's QmlInterface structs. Fix that, too. The rabbit hole went deep. Change-Id: Ia451897e927e03b95c3062e829edf1dfcd216613 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Prefer qHypot() over sqrt(a sum of squares)Edward Welbourne2021-02-011-0/+1
| | | | | | | | | It's apt to be more accurate and may even be optimised. Comment on a benchmark where we could use Math.hypot(), but that would break comparison with Qt 5 results. Change-Id: I7c37dd3df82fdef18e7ebb0e1548198afd256faa Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* tst_qqmlecmascript: Adjust to QObjectCompatProperty change in qtbaseFabian Kosmale2021-02-011-2/+2
| | | | | | | Fixes: QTBUG-90786 Change-Id: Id05afbeb18b7c30246a29b95673a1319649f389f Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* Expose getter and setter names of C++ classes in qmltypes filesFabian Kosmale2021-01-292-2/+9
| | | | | | | | | | | This simply exports the name which are already available in the json files generated by moc. We do not consider whether the methods are non-private for now. MEMBER is not supported either, but might be added if the need actually arises. Fixes: QTBUG-90711 Change-Id: If3ee18c8ce60499676a7ee22df569cba0912e22f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* V4: Store instruction pointer before CmpInUlf Hermann2021-01-271-0/+13
| | | | | | | | The "in" operator may throw an exception. Change-Id: I7d0b6e2212ac6ec237fbf14719349f8e23810028 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Make the nameFilters test resilient to file system changesVolker Hilsheimer2021-01-262-4/+4
| | | | | | | | | | | | | | | | | | | | The test failed reliably when the directory in which the test started had the same number of files as the directory that the test wants to read. That's because the QTRY_COMPARE matches immediately and doesn't process events, which leaves queued signal emissions pending. So, count tests passed - for the wrong reason - and follow up tests failed. To make the test robust, start with an invalid directory, which we know is empty. Once switching into the test directroy, the test will have to process events. Remove the BLACKLIST file. Fixes: QTBUG-90468 Change-Id: I9b3c4dc1a15b0b5ab6c632c12752b038164b9d9d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Return after importing a scriptUlf Hermann2021-01-263-0/+9
| | | | | | | | If we don't return there, the newly imported script is promptly overwritten by an invalid module. Change-Id: I788a7275e2c190a20c176da35f5c76ac9f6ad02b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Complain if member access check fails for namespaced typesUlf Hermann2021-01-262-0/+9
| | | | | | | | Before, we would prepend the namespace to the name, but then continue right away, never checking the new name. Change-Id: If90db7d33536fb4b549321c2d6b677040605b6f0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlJSTypeReader: Guard against empty JS filesUlf Hermann2021-01-263-0/+10
| | | | | Change-Id: Ie52ce15b7fa960ce84a6d17a21a0e307a38c726e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmltyperegistrar: Make sure we have metatypes for all QML typesUlf Hermann2021-01-255-0/+150
| | | | | | | | | | We need to be able to resolve any QML type from its C++ name using QMetaType::fromName(). qmltyperegistrar can generate the missing metatypes, either by creating synthetic ones (for namespaces), or by making sure the existing ones are registered (for others). Change-Id: If775af56d891f2c2a5bb94589b3cb05a199c7c35 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlPropertyBinding: improve error reportingFabian Kosmale2021-01-256-0/+118
| | | | | | | | | | | | | | | | | | This change ensures that bindings created in QML between new-style properties contain information about which property caused the loop. To do this, we store additional information about the property involved to retrieve its name and position at a later point. We print the warning in case we detect a binding loop in evaluate, and also set the error reporting callback correctly, so that the condition can be reported when the loop is detected in another part of the binding evaluation. In addition, we do not only set the QPropertyBinding's error member when JS evaluation results in an error, but also print the warning with qmlWarning. Fixes: QTBUG-87733 Change-Id: Idb25237d1f57355ca31189e6bf2a918430b3a810 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QJSEngine: Add a function to throw a pre-generated error objectUlf Hermann2021-01-221-2/+4
| | | | | | | | | | | | | | | It makes little sense that you can construct an error object but not throw it. The test was definitely meant to actually throw the error object, not return it. [ChangeLog][QtQml] QJSEngine has gained an additional overload to the throwError() method, with the effect that calling throwError() with a character literal as argument is now ambiguous. You should explicitly construct a QString instead. Change-Id: I90c6c9edf10509daa142a86581d6a3f7ff45af2c Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Fix auto-importing of qmltypes from same directoryUlf Hermann2021-01-213-0/+27
| | | | | | | Fixes: QTBUG-90513 Pick-to: 6.0 Change-Id: Ic39e72d6df20be30c61123a7f8091d70dbc2d924 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid memory leaks in QSequentialAnimationGroupJob testUlf Hermann2021-01-211-4/+9
| | | | | Change-Id: Ib221f83ff80ed02f29b1dbe2767ccf63abf16738 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Expose the list of preferred instance extensions to rendercontrol usersLaszlo Agocs2021-01-211-0/+2
| | | | | | | | | As all QRhi stuff is private, it needs to have a public counterpart in Qt Quick in order to fully support the case of Vulkan-based QQuickRenderControl usage. Change-Id: Iaf9a7aa56022acd31af6ebf16de6b83a04966ff4 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* qmllint: Remove exceptions for most unknown builtinsUlf Hermann2021-01-211-0/+2
| | | | | | | | | | | | All those types are properly defined in the qmltypes files now. We just need to search the enumerations the same way as methods and properties in order to find everything. Also, deduplicate the code that resolves properties, methods, and enums by using a common template for iterating the scopes. Change-Id: I0bf1423974d0ec8f602ecd0342522b3e981a8586 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use new QObjectPrivate connection mechanism in dynamic connectionsAndrei Golubev2021-01-213-0/+105
| | | | | | | | | | | Old API assumes sender == receiver, which results in wrong handling of connections when receiver is deleted: connection is not removed or notified elsehow as it's not really tied to a valid receiver Task-number: QTBUG-86368 Pick-to: 5.15 6.0 Change-Id: I0f3115f1b0f26cf353752ba2b8fd88e0f3bdd388 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>