aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypewrapper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-311-10/+12
|\ | | | | | | Change-Id: Idde38761897f078cd9957f01d34a9751217e4c53
| * Fix exposure of -1 as enum value in QML exposed C++ singletonsSimon Hausmann2018-01-311-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a C++ singleton has an enum with the value -1, we would expose that value correctly when taking the accelerated property access code path in the optimizer, but when going through the slower QQmlTypeWrapper we would return undefined. This turned out to be a silly logic error that assumed that -1 is not a valid value for an enum and instead indicates an enum value not present. [ChangeLog][Qml] Fix -1 as enum value in QML exposed C++ singletons showing up as undefined. Task-number: QTBUG-66067 Change-Id: Ib66dad7a4b59822b2c40ad6bd9af4b72469582e9 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-08-181-39/+55
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4qobjectwrapper.cpp src/qml/qml/qqmlcustomparser.cpp src/qml/qml/qqmlimport.cpp src/qml/qml/qqmlimport_p.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmlmetatype_p.h src/qml/qml/qqmltypenamecache.cpp src/qml/qml/qqmltypenamecache_p.h src/qml/qml/qqmltypewrapper.cpp src/qml/qml/qqmltypewrapper_p.h src/qml/qml/qqmlvmemetaobject.cpp src/qml/util/qqmladaptormodel.cpp Change-Id: Ic959d03e6f9c328fb02710d9abbb0f27cddde131
| * Fix void * usage in our internal APIsLars Knoll2017-08-021-1/+1
| | | | | | | | | | | | Task-number: QTBUG-61536 Change-Id: Ia2b5cfeab093d8be91728032528788dd238c2872 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Change data structures in QQmlMetaTypeDataLars Knoll2017-08-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure any QQmlType stored in the meta type data has a refcount of 1. This should now make it possible to clean out unused types by iterating over the list of types and removing those that have a refcount of 1. Some care is still needed for C++ registered types, that will need to get one more refcount, so we don't accidentally remove them. Task-number: QTBUG-61536 Change-Id: Id2a18dae5ddcb815f34013f5fde1f05d2d9d0214 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Use QQmlType by valueLars Knoll2017-08-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | QQmlType is now refcounted, and we need to use it by value, to control it's lifetime properly. This is required, so we can clean up the QQmlMetaTypeData cache on engine destruction and with trimComponentCache() Task-number: QTBUG-61536 Change-Id: If86391c86ea20a646ded7c9925d8f743f628fb91 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Use QQmlType by value in the type wrapperLars Knoll2017-08-021-32/+35
| | | | | | | | | | | | Task-number: QTBUG-61536 Change-Id: Ie40cb3a6e170331b0ec7ab5deaf7c1d7ef0cdaeb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QmlTypeWrapper: -> QQmlTypeWrapperRobin Burchell2017-05-041-28/+28
| | | | | | | | | | | | | | That poor Q looked so lonely. Change-Id: Ie4cef3fa8f2ecb8ba106654e8a9d6611a9407aa2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | C++11 scoped enum support for QMLMichael Brasser2017-05-031-0/+29
| | | | | | | | | | | | | | | | | | [ChangeLog][QtQml] Support C++11 scoped enums in QML. These can now be accessed as <TypeName>.<EnumName>.<EnumValue> Change-Id: I29bd3f16e980f3e6f1b2390b5a8e9e8e999952a3 Task-number: QTBUG-54961 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | qml: Override the new Object::instanceOf hook to allow QML type checkingRobin Burchell2017-03-151-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtQml] The instanceof keyword in JavaScript has been extended to work on QML types and instances. This means that you are now able to use it to verify that a var is indeed the type you expect (e.g. someVar instanceof Rectangle). Note that one of the added tests revealed a slight shortcoming in the QML type system (QTBUG-58477). For now, we should keep consistency and work to address the problem universally in the future. Change-Id: I7d9bf9b64cfd037908de1ae51b01065eacb95abe Task-number: QTBUG-24799 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-021-5/+10
|\| | | | | | | Change-Id: I6cbd83b61fac34c2ba6936711289ec09a490719a
| * Use QQmlType for looking up enums, even on singletonsUlf Hermann2017-02-081-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QQmlType has more information than the bare QMetaType. The optimizer already uses it for looking up enums, so some code would behave differently, depending on whether the optimizer was enabled or not. In some cases we cannot use QQmlType for lookup of enums because QQmlType might have been created with only a callback. The object only shows up later in that case. Then the only thing we can do is query the metatype. We can test this by adding an eval() because eval() disables optimization for the surrounding code. Task-number: QTBUG-58394 Change-Id: I8c90591b19fe1ed3e5339d877f9e6ec7c6f9aa73 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Object: Allow put and putIndexed to return success or failureRobin Burchell2017-02-091-6/+9
|/ | | | | | | | | Some parts of the ES6 (and even ES5!) spec specifically require handling of a property write failure. This will be introduced in followup changes, as it's going to be rather more involved than this. Change-Id: Ie482493fcf4780df0e23619650a856421d20bd55 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Start cleaning up the QmlContextWrapperLars Knoll2016-12-041-1/+0
| | | | | | | | | The class should get merged with the QV4::QmlContext class. Simplify the cleanup by moving both classes into a common file. Change-Id: I0074da79701d5f41eb51681b70fcde85bfd45fc1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Also check for correct destroy() chainingErik Verbruggen2016-10-061-0/+1
| | | | | | | | | Check that the destroy() method of Heap::Base was called when a Managed object needs destruction. This checks if a call to the parent's destroy() method was accidentally omitted. Change-Id: Id025ecd6d4744bf3eab23503fbe317ed2a461138 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Make Heap::Object and all subclasses trivialErik Verbruggen2016-10-061-2/+3
| | | | | | | | | | | | GCC6 might dead-store-eliminate out our secret write to Base::mmdata, because it expects all memory content to be "undefined" before constructor calls. Clang might take the same approach if the constructor of Heap::Object is removed. By making these structs trivial, it also makes them memcpy-able. Change-Id: I055b2ad28311b997fbe059849ebda4d5894eaa9b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Introduce destroy() on Base subclassesErik Verbruggen2016-10-051-1/+1
| | | | | | | | This removes the destructors of subclasses of Base, making them nearly trivial. Change-Id: Ia6f7d467e87899b5ad37b8709a8f633a51689d59 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Replace QPointer with a QQmlQPointer (which is trivial)Erik Verbruggen2016-09-271-0/+2
| | | | | | | One of the steps needed to make QV4::Heap::structs trivial. Change-Id: Ic4d73f15035af21c8a682aaad1ee68cdd91f8e7d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* V4: allow inlining of ExecutionEngine::{qml,js}Engine()Erik Verbruggen2016-05-201-0/+1
| | | | | | | | All other changes are just to be able to include qv8engine_p.h in qv4engine_p.h Change-Id: I71ba2ec42cdc20d5c7d97a74b99b4d1ada1a5ed8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7J-P Nurmi2016-03-011-18/+56
|\ | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro Change-Id: I3ca8f0422828191b7e19539c25f31f2d048e9f18
| * Properly signal errors when accessing lowercase enum valuesThomas McGuire2016-02-241-18/+56
| | | | | | | | | | | | Task-number: QTBUG-46758 Change-Id: I14e394021c231bda5552c8d1c98f20c903a62f12 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-191-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Make QML composite types inherit attached propertiesJ-P Nurmi2015-10-091-2/+3
| | | | | | | | Change-Id: Ic06af4805da987dd08e361f2668e7a1788d3eefe Task-number: QTBUG-43581 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Move remaining objects to new constructor syntaxLars Knoll2015-09-221-8/+4
| | | | | | | Also disable the old way of constructing objects. Change-Id: Ib4e69087cd563ae1481da116d6caf97876239798 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make QML composite types inherit enumsJ-P Nurmi2015-09-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Problem: in Qt Quick Controls 2, enums declared in the abstract C++ base types were not accessible with the concrete QML type name, but had to be referenced using the base type name: Slider { snapMode: AbstractSlider.SnapOnRelease } Solution: this change resolves the C++ base type and creates the missing link between the composite type and its base type's meta- object. This allows referencing enums using the concrete/composite QML type name: Slider { snapMode: Slider.SnapOnRelease } Change-Id: Icefdec91b012b12728367fd54b4d16796233ee12 Task-number: QTBUG-43582 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Cleanup retrieval of scope and context objectsLars Knoll2015-06-181-2/+2
| | | | | Change-Id: I9c6174181f950bc4f829727dc6acdfe82fa4e894 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-04-221-0/+3
|\ | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlbinding.cpp src/qml/jsruntime/qv4arraybuffer.cpp src/qml/jsruntime/qv4functionobject.cpp Change-Id: Ic752e9dfd69b282093651c9234c110a49762f06d
| * Address uninitialized pointer variablesHolger Hans Peter Freyther2015-04-201-0/+3
| | | | | | | | | | | | | | | | Coverity CID 10721, 84861, 86705, 85424, 85422, 85259, 84863, 84857 Change-Id: Ia86970b5ac4e0be9de01b79b618d33011da6a328 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Further cleanupsLars Knoll2015-04-161-3/+3
|/ | | | | | | | | The get and getIndexed vtable methods should take a const Managed pointer. Start cleaning up the asFoo() methods in Value and Managed by removing asArrayObject() and asErrorObject(). Change-Id: Ibd49bf20773ef84c15785b7ac37a7bc9fd4745d5 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>
* Get rid of most uses of ValueRefLars Knoll2015-01-231-2/+2
| | | | | | | | | | | | Instead pass a const Value & into the functions With our new inheritance structure, we can get rid of ValueRef and instead simply pass a pointer to a Value again. Pointers to Values are safe to use again now, as they are now guaranteed to be in a place where the GC knows about them. Change-Id: I44c606fde764db3993b8128fd6fb781d3a298e53 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework QJSValue internalsLars Knoll2015-01-211-2/+2
| | | | | | | | | | | | | Use a flagged pointer to either store a pointer to a QV4::Value (from the persistent storage) or a pointer to a QVariant in QJSValue::d. Like this we don't need to malloc to create a QJSValue for most use cases. Significantly reduces the memory consumption of QJSValue and speeds it up a lot. Change-Id: I10902cc4b6cc3f43d3f816875dc6c4bbb6b4490f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of all uses of Managed::engine()Lars Knoll2015-01-211-3/+3
| | | | | Change-Id: I596f14554d81f5e9af9996294d96047f2e810bef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove all the setVTable() calls that aren't required anymoreLars Knoll2015-01-211-1/+0
| | | | | | | | The memory manager's allocation methods now set this up correctly for us :) Change-Id: I8492bf732df601f95a1a851fb3804127ffc83935 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Refactor persistent valuesLars Knoll2015-01-161-1/+1
| | | | | | | | | | Use a page wise allocation mechanism for persistent values. This significantly reduces memory consumption of persistent values and also improves their performance a lot. Change-Id: I8499d2ca5bdd871e029f643ae605a94544558bb5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove v8engine from qmlcomponent and canvas2dLars Knoll2015-01-081-3/+2
| | | | | Change-Id: I575ba208de24ffe90bd02905aba67b0b08c5115e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove v8engine usage in the value type providerLars Knoll2015-01-081-3/+3
| | | | | Change-Id: I6b26a8249175a86c6e15d000b24ba3300e112715 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Reduce v8engine dependency in the type wrapperLars Knoll2015-01-021-19/+14
| | | | | Change-Id: I3a50aa3c0929c14ad856463635bf2fb2188f5c9f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup destruction of heap objectsLars Knoll2014-11-211-5/+0
| | | | | | | | Generate the code from a macro instead of duplicating boiler plate code. Operate on Heap::Base instead of Managed. Change-Id: I84c5a705980899be3e5b931a093645e50d3923bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix the qmlProperty accessors to not require a context anymoreLars Knoll2014-11-211-4/+4
| | | | | Change-Id: Ied5ad5b2fef494de77aefdb4a7ee25aff4d7722a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move data of more Qml related objects into Heap namespace.Lars Knoll2014-11-101-6/+8
| | | | | Change-Id: Ifb3a7093351474d6feb2f64498b531c36fdf669b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Object::Data into the Heap namespaceLars Knoll2014-11-081-1/+1
| | | | | Change-Id: I9d30081f71b83bc86f5e5714e23396b18c4d54c5 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>
* Get rid of !this and similar constructsLars Knoll2014-10-311-11/+8
| | | | | | | | | The C++ standard doesn't allow calling member functions on a mull object. Fix all such places, by moving the checks to the caller where required. Change-Id: I10fb22acaf0324d8ffd3a6d8e19152e5d32f56bb 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>
* Accelerate property lookups for C++-based QObject singletons.Michael Brasser2014-08-071-0/+11
| | | | | Change-Id: Icbdf06a077014db5dd57cba42f84591433ec4196 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change the object allocation schemeSimon Hausmann2014-07-221-2/+2
| | | | | | | | | Instead of allocating the data directly, centralize the object and its ::Data allocation in one place in the memory manager. This is in preparation for additional pointer indirection later. Change-Id: I7880e1e7354b3258b6a8965be378cd09c9467d25 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Convert TypeWrapper and ValueTypeWrapperLars Knoll2014-07-221-10/+10
| | | | | Change-Id: Ib1debebda1cc6dbfaf9c6dca40cde72800a2769b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of StringRefLars Knoll2014-07-221-10/+8
| | | | | | | | Remove the Ref classes, as they won't be required anymore once Managed and Managed::Data are separated. Change-Id: Ic6bec2d5b4ecf2595ce129dbb45bbf6a385138a5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert type wrapper to new data layoutLars Knoll2014-07-221-24/+25
| | | | | Change-Id: Ie569c4419addf31fc0297bbc4acdf08269a3e80e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>