aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/testtypes.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QtQml: Add a wrapper builtin for QQmlV4Function*Ulf Hermann2024-04-121-1/+1
| | | | | | | | | This way qmltyperegistrar can recognize it and refrain from warning about it. Task-number: QTBUG-101143 Change-Id: I598140e7e90dbd3e27a78c26eff3d46f0fd3e989 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Correct license for test filesLucie Gérard2024-02-271-1/+1
| | | | | | | | | | | | | | According to QUIP-18 [1], all test files should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I26d72e8de04d4c7c57b3b7838af5d033265de5ba Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Prepare tests for upcoming incremental gcFabian Kosmale2023-11-221-3/+2
| | | | | | | | | | | | | | | | | | | | | | This commit: - Introduces helper functions gcDone and gc. gcDone simply returns true as the gc is currently not incremental. gc is a helper method which has been copied into various tests already, which runs the garbage collections and sends events to clean up objects scheduled for deletion. The new helpers are placed in qmlutils.cpp. - It adds a flag to gc which allows not sending the posted events. That allows using gc in more places, while highlighting the fact that we don't want to process events at this point. This will also help upcoming changes to the incremental gc, which by default will use the event loop to drive the gc processing - It moves some gc calls from QML to C++ – this again will help later to ensure that the gc actually has completed As a driveby, the logging rules early in tst_qv4mm are reset earlier. Task-number: QTBUG-119274 Change-Id: I75d6ffcb3aa459b020e8257155faa91c39653d43 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlProxyMetaObject: Forward objectDestroyed to parentTor Arne Vestbø2023-10-201-0/+5
| | | | | | | | The parent might have a different implementation of objectDestroyed than QDynamicMetaObjectData, for example not deleting the object. Change-Id: I7420ea577d9dc76bc13d11c54b6e0004205f13af Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix regression on singletons where declared != actual typeFabian Kosmale2023-10-091-0/+2
| | | | | | | | | | | | | | | | | | | | For singletons, we can't rely on the static meta-object of the registered type, as the create function used for a singleton might return an instance of a derived type instead. This could lead to crashes or method-overload resolution failures later on. Fix this by always querying the actual meta-object of the singleton, instead of relying on the meta-object of the registered class. Leave a comment about the fact that we still have an issue if you have a derived instance of the registered type when you additionally extend the type. However, that is pre-existing (given that it only affects QQmlType itself). Fixes: QTBUG-117891 Pick-to: 6.2 6.5 6.6 Change-Id: Ie12b4c886ace5cc58a5ded59fa48bc425ae58419 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove remaining foreach in qml testsUlf Hermann2023-08-221-3/+1
| | | | | | | Task-number: QTBUG-115808 Change-Id: If02f3cbb97e8a6035544d10ee2c23f5c87ed618c Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Mark the module as free of Q_FOREACH, except where it isn'tMarc Mutz2023-08-171-0/+3
| | | | | | | | | | | | | | | | | | | The density of Q_FOREACH uses is high here, too high for this author, unfamiliar with this code, to tackle in a short amount of time. But they're concentrated in just a few TUs, so pick a different strategy: Mark the whole module with QT_NO_FOREACH, to prevent new uses from creeping in, and whitelist the affected TUs by #undef'ing QT_NO_FOREACH locally, at the top of each file. For TUs that are part of a larger executable, this requires these files to be compiled separately, so add them to NO_PCH_SOURCES (which implies NO_UNITY_BUILD_SOURCES, too). Created QTBUG-115808 to keep track of this. Task-number: QTBUG-115808 Change-Id: I29c377f939e3d747e3ce72c224c4ee722df7a95d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Un-specialcase QStringList and QVariantList conversionUlf Hermann2023-06-301-0/+12
| | | | | | | | | | | | | | | | | | Those are just regular sequences these days. They can be written back. Drop some now-dead code and deduplicate the value type conversion code in the process. We should try the (more common) value type conversion before the sequence conversion, but after all the "simple" conversions. [ChangeLog][QtQml][Important Behavior Changes] Converting a QVariantList to a QJSValue via, for example QJSEngine::toScriptValue() does not produce a JavaScript array anymore, but rather a better suited sequence object that behaves almost like a JavaScript array. The only difference is that its QJSValue::isArray() will return false now. Fixes: QTBUG-113690 Change-Id: Ib176c34d59c45a6b5cff68d029c4b1b87d7aa192 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* ListProperty: Document faulty index-assignment on gadget list propertiesOlivier De Cannière2023-06-161-0/+27
| | | | | | Task-number: QTBUG-113690 Change-Id: I2816f55b501ee9192cedf5e4b108ac498cbcae35 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix reset support for value typesFabian Kosmale2023-05-121-0/+1
| | | | | | | | | | | | | | Our value type refactoring in 6.5 broke reset support for value types when that write happens through virtualPut. Fix that by checking whether the value we're assinging is undefined before attempting any conversion, and reset the gadget in that case (if it is actually resettable). Task-number: QTBUG-113473 Pick-to: 6.5 Change-Id: Ifaa2d045f718fc3cb2d5e75b3626b41175ac3a3b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
* QQmlObjectCreator: Do not crash on read-only bindableUlf Hermann2023-01-051-0/+1
| | | | | | | | | | | If the binding was not actually set (because the bindable is readonly) then it's dead after the pop_front. We cannot examine it anymore, and we don't have to. Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-109597 Change-Id: I3bf0ca501aa9ad45a64ad181b685ca6d9d325231 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-27/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Allow ImmediatePropertyNames in addition to DeferredPropertyNamesUlf Hermann2021-10-281-0/+3
| | | | | | | | | | | | | | If given, all properties but the ones mentioned in ImmediatePropertyNames are deferred. Also add some warnings related to DeferredPropertyNames being ignored in some cases. Finally, scanObject() can return false now. Therefore adapt its caller to take that into account. Task-number: QTBUG-95117 Change-Id: I1e696228de7ad3b495bf7791fdb014768aff4c96 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* tst_qqmlecmascript: Test that deferred names gets overwrittenMaximilian Goldstein2021-08-311-0/+1
| | | | | Change-Id: I32d7ba2230dbd98f918e6e55abbe6b3fd43028d2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* tst_qqmlecmascript: Check that parent can defer child class propertiesFabian Kosmale2021-08-261-0/+1
| | | | | | | | | | | It is arguably a bad idea to defer properties which might get defined in child classes, but checking it in the engine would be expensive: We cannot simply check that the property exist, as we might want to defer attached properties. So for now, we add a test to document and verify the behavior. Change-Id: I264b136638c4ecddfa52b6687797cb981d9b531e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* tst_qqmlecmascript: Test that it is possible to defer parent propertiesFabian Kosmale2021-08-251-0/+1
| | | | | | | | | | | This test is meant to narrow down the semantics of the currently underspecified deferred properties. Task-number: QTBUG-95117 Change-Id: Iee6b9d4caea1a248cf5c2d6773e12a314c01bae7 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Mark overrides in tests to silence compiler warningsVolker Hilsheimer2021-04-111-2/+2
| | | | | | Pick-to: 6.1 Change-Id: Ieed929dcd7b550a1dc365d34b6f20f2f0e2d057f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QV4QObjectWrapper: Store the whole signalFabian Kosmale2021-04-011-0/+3
| | | | | | | | | | | | | | | | | | | | | 90be89d771425044a84e9e79e4e668e065acc825 changed the connection logic to actually pass the receiver to connect in order to fix disconnect cleanup. However, we omitted to change QObjectSlotDispatcher::impl accordingly. The previous logic was: - store the index of the signal in signalIndex - In impl, in the call case, we would get passed the emitting object (sic!) as the receiver parameter. Then we would use the object and the signal index to obtain the QMetaMethod. - From the QMetaMethod, we could get the signal's number of parameters. After the aforementioned change, that does not work anymore: The receiver is now the actual receiver of the signal, thus we get the wrong method, and potentially the wrong number of parameters. To fix this, we now store the complete QMetaMethod of the signal. Pick-to: 6.1 Change-Id: I868c51edf24a61d14eaf958ed7942da27f54a5c3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlPropertyBinding: handle resetFabian Kosmale2021-03-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bindings are allowed to toggle between a defined state, and undefined which calls the property's reset function. Calls to the reset function must not remove the binding, even when they write to the property. To support this, we put the binding in a special undefined state, in which it is still active (and installed on the property), but does not actually provide its evaluated value to the property. Then, when the binding later becomes defined again, the binding leaves its undefined state and works normally again. Notes: - Calling the reset function during binding evaluation could have all kinds of unwelcome side-effects. We therefore have to suspend binding evaluation before the reset call (and restore that state afterwards). - QObjectCompatProperty expects that we write the current value into the propertyDataPtr. If we do not do this, it will overwrite the current value with the default constructed value of its property. Arguably, we should change the API so that we communicate that nothing has changed; but for now, we have to live with that limitation and read the current value and write it back again. - We currently do not handle the case correctly where a non-resettable property implemented via QObjectCompatProperty gets assigned undefined in a binding. Such a binding is likely unintentional (as the undefined assignment only creates a warning), and thus less of a priority. Nevertheless, a test marked with QEXPECT_FAIL is added for it. Fixes: QTBUG-91001 Change-Id: I7ecaa6c8dc1a1f1b33e67b1af65f552c4ca6ffb1 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QQmlListProperty: Use qsizetype rather than int for sizesUlf Hermann2020-11-091-2/+2
| | | | | | | | | | [ChangeLog][QtQml] The QQmlListProperty callback functions use qsizetype now as type for the size of a list. This is in line with the containers that you might use to back the list. Fixes: QTBUG-88269 Change-Id: Ia38403cb32f241e6c70e1a580dbeff1d6d694331 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Adjust to qtbase changesFabian Kosmale2020-09-041-1/+1
| | | | | | | | | | | | | - isQProperty has been renamed to bindable - QNotifiedProperty is no more - Bindable properties have a function to obtain the QBindable; store that information in the qmltypes files. Task-number: QTBUG-86434 Task-number: QTBUG-86435 Change-Id: I2ba593af1e197d04d2c30cfb9e6904a3d2059e4b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Do not set QQmlPropertyBinding until we reach finalizeFabian Kosmale2020-08-121-0/+6
| | | | | | | | | | | If we install the binding eagerly, context properties cannot be resolved yet, as the context object has not been created so far. This causes issues with a QNotifiedProperty using a callback which accesses the current value, and thus forcing the binding evaluation while the object creation is still ongoing. Change-Id: I3bf3def04cd044371cb757a1854a3224a9c669b8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add ; to Q_UNUSED and UNUSED_PARAMLars Schmertmann2020-06-261-17/+17
| | | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: Iead53d18fd790fb2d870d80ef2db79666f0d2392 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add support for binding directly to QProperty instancesSimon Hausmann2020-03-301-0/+2
| | | | | | | | | | Avoid going through externally managed bindings and instead allocate a more lightweight property binding. It's basically a QQmlJavaScriptExpression and one pointer plus the overhead of QPropertyBindingPrivate. Change-Id: I1530330926d351b61f2b3bbad39301c628a8bef1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-8/+8
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.10Lars Knoll2017-09-201-1/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compileddata.cpp src/qml/compiler/qv4compileddata_p.h src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4qmlcontext_p.h src/qml/jsruntime/qv4regexpobject.cpp src/qml/jsruntime/qv4regexpobject_p.h src/qml/types/qqmllistmodel.cpp src/quick/items/qquickanimatedimage_p.h src/quick/scenegraph/qsgrenderloop.cpp tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp Change-Id: If20ef62b2c98bdf656cb2f5d27b1897b754d3dc0
| * Stabilize the threadSignal() testSimon Hausmann2017-09-061-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've seen the case in the CI where we delete the worker thread object before it has had a chance (resulting in a crash). This patch attempts to stabilize this by waiting for the thread to terminate properly. In addition QSignalSpy's connection to the done(QString) signal is forced to be direct, which means the spy's internal list is accessed from the gui thread (via QCOMPARE) at the same time as the thread may be emitting the signal and calling the signalspy's slot (metacall), which helgrind complains about (rightly so). I don't see any purpose in connecting to the signal, so let's remove that code. The test continues to cover the threading code in QQmlData::signalEmitted, once as the thread is triggered via C++ and once via QML (doIt invocation). Change-Id: I5e8a4ae65e2d0890a26491d25c73de1ba33a6668 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Add support for std::vector and QVector matching the support for QListVille Voutilainen2017-04-211-0/+24
|/ | | | | | | | Task-number: QTBUG-60133 Change-Id: I5497dc3c4a1c3922e7147d7a20593c75a0d9d0e9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Directly load already known metaproperties in QV4QObjectWrapperUlf Hermann2017-02-151-0/+2
| | | | | | | | | | | | | A method and a property can have the same name in a QObject. This is not directly expressible in a JS object, but when iterating the properties of a wrapped QObject we should not look them up by name as we might find the wrong one this way. However, as we already know what we are looking for, there is no need for any further searching anyway. Task-number: QTBUG-58887 Change-Id: I68574008c7a078baab9b343d550cc27956b0d5a9 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add QVector support to JS sequencesKevin Ottens2016-05-031-0/+12
| | | | | | Change-Id: I731355aa1754721236f3711a65af4f96781cebc0 Task-number: QTBUG-51467 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-291-0/+1
|\ | | | | | | Change-Id: Iec1b2de53c275996364c4bab0123ccb3e6e9895e
| * Don't check for revisions when assigning to grouped propertiesLars Knoll2016-01-271-0/+1
| | | | | | | | | | | | | | | | | | | | This leads to wrong behavior in some cases, where we reject valid revisions, and there is probably no case, where this could lead to a conflict for the user of the API. Change-Id: I1614332cf4c07c6a227551612331dd69b2ae71f3 Task-number: QTBUG-40043 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-201-17/+12
|/ | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I04760a0801837cfc516d1c7c02d4f503f6bb70b6 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Don't delete singletons objects owned by C++.BogDan Vatra2015-10-151-0/+33
| | | | | | | | | | This way we can enable the usage of a single singletons in both worlds. Currently singletons are destructed before the other QML types, and using a singleton that is owned by C++ we don't need to care about the destruction order anymore. Change-Id: I120fcb8659e16321ae6e70c7b0d62be3bc650d73 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Remove v8engine pointer from QQmlV4FunctionLars Knoll2015-01-081-1/+1
| | | | | Change-Id: I68ddd79b8866ef9b8628a2eab1118d3ee3d72759 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the throw methods from ExecutionContext to ExecutionEngineLars Knoll2014-11-041-1/+1
| | | | | | | | The methods don't require a context, and thus shouldn't be implemented there. Change-Id: If058e0c5067093a4161f2275ac4288aa2bc500f3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-291-0/+60
|\ | | | | | | Change-Id: Id95f7b01de36bccecbb7b73acc041654a1fe2ebe
| * Fix interaction of garbage collector with JS objects during QML type ↵Simon Hausmann2014-07-261-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instantiation It may happen that during the lengthy process of instantiating a tree of objects for QML, the garbage collector runs. For objects created by QML we support different ownership models, for example in QtQuick visual parents keep their visual children alive, despite perhaps a lack of QObject parentship. That ownership becomes active once the QML autoparent function has assigned the correct visual parent, which happens after object instantiation (after QQmlObjectCreator). Similarly when a composite type is created, its QObject parent is only set after all properties have been set. The root QObject is kept alive through a special boolean, but if the sub-objects aren't children yet, their JS wrapper might get deleted. For composite types with var properties, that also means their var properties get deleted, such as the model property of TableView.qml in the bug report. In the future we want to support creating QWidget hierarchies with QML, which also for layouts may rely on a delayed parent assignment for layouts. To accommodate all this, this patch introduces an array on the JS stack that keeps track of all JS wrappers for all QObjects created. This array is alive during object tree creation. Afterwards, the different ownership models take over, for example the auto parent function assigning a visual parent. This patch also fixes an off-by-one in the total object count calculation for composite types, where when instantiating a composite type as a sub-object we counted the sub composite's object count but forgot the object itself. Task-number: QTBUG-38835 Task-number: QTBUG-39966 Change-Id: I6104b2434510642081e0c54793ed296adeca7481 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | qmlRegisterCustomExtendedType, qmlRegisterExtendedUncreatableTypePaul Lemire2014-07-251-0/+41
|/ | | | | | | | | | | | | | | | | | There are cases in Qt3D where we'd like to be able to register uncreatable extended types. The main use case is having an abstract class that has an extension class so as to have a clean separation between the C++ and QML API. Implementations of the abstract can then be easily registered to QML and rely on the extension class for QML specific properties. The other feature we'll need in the near future is the ability to create extended QML types that use a custom parser. Two new type registration method were added to qqml.h to fulfill those needs. Unit tests for those are present in qqmlecmascript and qqmllanguage. Change-Id: I15b2cd791ffd36b537305af1873491c079d4094e Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix lookups of enums in singletonsSimon Hausmann2014-01-021-0/+7
| | | | | | | | | | | | | | | | | | | This is a regression against 5.2.0 (which didn't have this bug), due to optimizations introduced in the stable branch after the release. The code path for optimizing access to the members of C++ based singletons through the regular meta-object properties would end up excluding access to enums when the lookup happens at run-time. The run-time getter for the singleton itself would return a wrapped QObject instead of a QQmlTypeWrapper, and only the latter includes enums. As QML based singletons (composite singletons) cannot declare enums, we can continue to do fast lookups on these, but otherwise have to fall back to the slower code path. Task-number: QTBUG-35721 Change-Id: Icc66bdaf3572622cdb718f82b706e3204afa0167 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Encapsulate the current context and fix it's usageLars Knoll2013-12-041-1/+1
| | | | | | | | | | | Encapsulate accesses to the current context, and rework the way we push and pop this context from the context stack. Largely a cleanup, but simplifies the code in the long term Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix === operator for value typesLars Knoll2013-11-151-0/+16
| | | | | | | | | Fix === comparison for urls and other QML value types. Task-number: QTBUG-33546 Change-Id: I4a7066e6bbc7de7c599fe2c7b2fdfb75e0ff5196 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Allow passing qmlRegisterSingletonType QObjects to C++ as QObject*Albert Astals Cid2013-11-141-0/+24
| | | | | | | | | | | | | At the moment you can pass them as their FinalType* or as one of their ParentType* but not as QObject* which does not make much sense to me Task-number: QTBUG-34617 Task-number: QTBUG-30730 Change-Id: Id5cfb7bbb123456ef43f44f33b450f8966a7641a Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Correctly convert an invalid QDateTime to JSLars Knoll2013-09-181-0/+11
| | | | | | | Task-number: QTBUG-33539 Change-Id: I645db2e12e3b46731c0bef04e2d48abb71650974 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't crash with deferred propertiesAlan Alpert2013-08-221-0/+1
| | | | | | | | | | | There are cases where a qmlExecuteDeferred(o) can be postponed until the context of o is being destroyed, at which point it's too late to create an object in that context. Task-number: QTBUG-33112 Change-Id: I7f981b5e34e3cb8a52c00de4742a7242d7e4df54 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove last traces of v8 API and v8 compatibility layerSimon Hausmann2013-06-121-3/+2
| | | | | | | | The debugger and profiler service remain as bigger parts that need to be ported properly to v4. Change-Id: I68e72d6db66fe497eb58ed60df417ffe4662d115 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Implement QObject ownership policy for QObject JavaScript wrappersSimon Hausmann2013-05-241-3/+0
| | | | | | | | | | | | | | | | | | | A parent with C++ ownership keeps its children alive. We know that all QObject wrappers are kept in a QWeakValue inside the QObject's QQmlData. As the weak values are registered to the MM, we can traverse there and mark the children if necessary in one extra pass. The handleReferenceManagement auto-test that covers this was actually testing the addGCRelationship implementation as well as the overal behavior. Some of the tests verify that a handle based overload of addGCRelationship works, so since those tests don't make sense anymore, I've removed them. Also fixed some cases where the test ran gc(engine) when it should've called gc() on the specific local QQmlEngine instance used in the test. This worked in V8 because the GC was "global". Change-Id: Ib394b46e034b016196804a9e73682507fa791445 Reviewed-by: Lars Knoll <lars.knoll@digia.com>