aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycache.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove last traces of QV8EngineUlf Hermann2019-05-081-1/+1
| | | | | Change-Id: I59f738402d51e39188bbbca2ef1fbc8a61612372 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Deduplicate QQmlPropertyCache::l{azyL}oadUlf Hermann2019-04-211-40/+16
| | | | | Change-Id: I0ca6d168abc076f93405791059db73667afa6009 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Dissolve QQmlPropertyRawDataLars Knoll2019-04-181-26/+26
| | | | | | | There is no reason anymore to split the class in two parts. Change-Id: Iabef7acec1db7afc0ed4e89e1fd5b78699dc0847 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Remove QQmlV4HandleUlf Hermann2019-04-101-3/+0
| | | | | | | | This is just an alias for QV4::ReturnedValue. We can as well use the latter. Change-Id: Ibd2c038a3ca726b39a8f0f05e02922adb9fccbdb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-02-251-6/+15
|\ | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlmetatype.cpp Change-Id: I517c001ea4eb0fdd8e469f9fffe5b7559a5b0795
| * Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-02-221-6/+15
| |\ | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktableview/tst_qquicktableview.cpp Change-Id: If3bf1abc23a59c458be0bb862d92f2edcb16b79f
| | * QML: Pass type minor version when creating property dataUlf Hermann2019-02-211-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Depending on the type minor version recursive properties should be available or not. Check for that when resolving grouped properties. Fixes: QTBUG-33179 Change-Id: Id8f62befdc4a29d879710499e19d3d289bd18775 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | * QQmlPropertyCache: support setting an explicit metaObject revisionRichard Moe Gustavsen2019-02-211-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating a QQmlPropertyCache for a QMetaObject, there were currently no way to specify which revision to use. Normally this is not needed, since when creating property caches for types declared in QML, the correct revision would be filled in later, based on the import version found in the QML file. But sometimes we need to create a QQmlPropertyCache for a QMetaObject created in C++, that has no associated QML file and import version. And if that meta object has revisioned properties, we need to specify which revision of the meta object the cache should represent. Otherwise, the revision would just be 0, which means that revisoned properties would not be found by the V4 runtime later. As an example, QQmlAdaptorModel has a set of classes that wraps various models (QAIM, arrays, etc). When a new delegate item is created by a view, an instance of a model class will be created as well (from C++). This instance will be set as context object for the delegate item, enabling properties such as index, row, column and model roles. But since row and column should a revision (currently they don't), we need to be able to specify that the property cache should have a revision that matches the import version of the view. That way, we can ensure that they don't shadow any existing row and column properties that might exist in the application from before, and as such, cause regressions. This patch will add an extra argument to the constructor that lets you specify which revision of the QMetaObject to use. Task-number: QTBUG-70031 Change-Id: I1c245a0c8b6f071e35865966fedc97f2839cd2f3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * PropertCache: Don't pass Q_GADGET value types as integersUlf Hermann2019-02-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | We need to check for the IsGadget flag there. Fixes: QTBUG-73734 Change-Id: Ic4afd4215e6ed346bc40794d85397f0f262715e2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Split propertyCache into multiple filesUlf Hermann2019-02-011-318/+1
|/ / | | | | | | | | | | | | I want to be able to read the code. Change-Id: I063143ff63b0a476d783c892e1d328e7f5133fab Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* / Property Cache: Use related meta objects to check for "enums"Ulf Hermann2019-01-041-58/+50
|/ | | | | | | | | | | | | | If a method of a QObject-derived class takes a "foreign" enum as a parameter, the enum's meta object is added to the "relatedMetaObjects" property. Therefore, we can actually determine if something is a named enumerator, even if we initially don't have its metaobject. This way we don't need to detect these types by their type flags anymore and therefore we can remove the band aid added in commit fd9d88e3a9f24eb84d029fb9324b4f03ae58ffeb. Change-Id: Id602d2b6f688a12b5addef855f6a16920b4e6549 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Use all available type information to find enum typesUlf Hermann2018-11-191-43/+69
| | | | | | | | | | | | Using the metatype system we can identify most enumeration types statically, without lookup by name. Only if we get UnknownType we have to do a name based lookup. As the name based lookup only checks enums that either belong to the global Qt namespace or the surrounding class, the type based lookup gives better results. Task-number: QTBUG-58454 Change-Id: Id6bd748f37838249defb4c5b2a7628eadc1a8341 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Handle changes in MOC internals - part 2Liang Qi2018-08-161-2/+4
| | | | | | | | | | Needed with newer qtbase. This amends 218fb96808f9ca4470427f68141eac64d1ad96f6. Task-number: QTBUG-69971 Change-Id: I970e65d8e0a977c52c6f187f955987811e774348 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Handle changes in MOC internalsAllan Sandfeld Jensen2018-08-141-2/+2
| | | | | | | Needed with newer qtbase Change-Id: I84222b06c615d60ad004512e43d3b6c6e904baea Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-36/+36
| | | | | | | | | | | | | 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>
* Allow exported signal handlers for signals with revisionThomas Hartmann2018-01-121-1/+2
| | | | | | | | | | | | | | | Properties of QML objects or alias properties to QML objects have to know about the revision of the QML type. If the property is used as a grouped property and a signal or property is assigned. Without this patch this is not working with signals that have a revision. To get this working we store the minor version of the QML type in QQmlPropertyData and retrieve the QQmlPropertyCache with the correct AllowedRevisionCache using this minor version. Task-number: QTCREATORBUG-18820 Change-Id: I1e20169e0d5a2ae11059a951aa83a5c94106accb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-08-181-34/+20
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Avoid meta-object creation when looking up QML properties in the property cacheSimon Hausmann2017-08-021-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When looking up QML properties in the property cache, we also need to verify that they should be visible in the QML context they are requested from, i.e. if the revision of the object in that context has the property visible or not. That requires retrieving the VME meta-object for QML declared properties. We can retrieve that directly from the QObjectPrivate instead of going through the potential meta-object builder creation path. Task-number: QTBUG-61536 Change-Id: I695921d625169de5c58941087464beb5367fb2db Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Move the engine pointer from the property cache to the VME meta objectLars Knoll2017-08-021-30/+12
| | | | | | | | | | | | | | | | | | This is where it belongs, and it makes the PropertyCache independent of the engine used. Task-number: QTBUG-61536 Change-Id: I21c2674ee3e2895abd2418764d140b154b47b868 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add support for enum declarations in QMLMichael Brasser2017-07-131-1/+20
|/ | | | | | | | | | | | | | | | | Enums can be declared with the following syntax: enum MyEnum { Value1, Value2 } Grammar changes done by Simon Hausmann. [ChangeLog][QtQml] Enums can now be declared directly in QML. Task-number: QTBUG-14861 Change-Id: Ic6b6e032651d01ee2ecf9d5ce5734976cb3ad7ab Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't crash: Connections with a signal on a nonexistent objectShawn Rutledge2017-05-071-1/+4
| | | | | | Task-number: QTBUG-56551 Change-Id: Ide09f177d3f6a3e9902f8ea904b3e6e4b998bd39 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Add fixes for INTEGRITYKimmo Ollila2017-01-311-2/+3
| | | | | | | Full definitions of types are needed in static_casts. Change-Id: I028ffc40a76cdb16cb297a181b3d9dfe9d09c945 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-11-231-0/+7
|\ | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4object_p.h Change-Id: Iff4d3aba7710a999b8befdc493cbe959e1ce02f9
| * QML: Add another specialization for QQmlPropertyCache::propertyErik Verbruggen2016-11-161-0/+7
| | | | | | | | | | | | | | | | | | QQmlListReference passes a QLatin1String in, which can behandled by the stringCache just fine. So if there is a cache entry, then this will skip toQString conversion. Change-Id: I13afe4f6e63d486b313ac58cbd86fb7f9e1a80f6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QQmlPropertyCache: adapt qQmlPropertyCacheCreateAnton Kudryavtsev2016-11-221-9/+8
| | | | | | | | | | | | | | ... to make good use of QL1S Change-Id: I7c3ac1cefb30bee9baa31a3f8ec08f5f57eb5d5b Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | QQmlPropertyCache: add property() overload with QStringRef argAnton Kudryavtsev2016-11-081-6/+11
| | | | | | | | | | | | | | | | Now we can pass 'name' arg as QStringRef. Client code can reduce allocations. Change-Id: I444f7135f4912f54d57e0a1193f330a3976fc186 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-221-0/+6
|\| | | | | | | Change-Id: I171c7dbb6a74fe743c2eec63e86e9c0bef7c7dfd
| * Fix excessive invalidation of QML disk cachesSimon Hausmann2016-10-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We use an MD5 checksum over the meta-object data to verify that the types a QML file depends on haven't changed since the cache was generated. However when the dependent types are QML types, then the meta-object data contains dynamically generated type names such as QMLTYPE_1234, which is non-deterministic. To address this, we resort to the checksum over the meta-object data only for C++ types (if those change it's likely an incompatible change) and for QML types use the fact that all the information about the QML declared types comes from the QML file only, which means we can in that case simply use a checksum over the QV4::CompiledData memory chunk. In addition we need to ensure that the generated CompiledData memory chunk is deterministic by avoiding any uninitialized bytes (memset) and using a map instead of a hash for the mapping of object index to object id. Task-number: QTBUG-55926 Change-Id: I27c840b1960ad36b486198e504b70989c22a3972 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-181-1/+6
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4variantobject.cpp src/qml/types/qquickworkerscript.cpp src/quick/scenegraph/util/qsgdefaultpainternode_p.h tools/qmljs/qmljs.cpp Change-Id: I876242714ec8c046238d8fd673a5ace2455b2b59
| * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-10-101-1/+6
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/quick/quickwidgets/quickwidget/main.cpp src/qml/jsruntime/qv4jsonobject.cpp src/qml/jsruntime/qv4qobjectwrapper.cpp src/qml/jsruntime/qv4qobjectwrapper_p.h src/qml/qml/qqmlengine.cpp src/qml/qml/qqmlpropertycache.cpp src/qml/qml/qqmlpropertycache_p.h src/quick/items/qquickanimatedsprite.cpp src/quick/items/qquickitem.cpp src/quick/items/qquickitem.h src/quick/items/qquickitem_p.h src/quick/items/qquickview_p.h src/quick/scenegraph/qsgcontext.cpp src/quick/scenegraph/qsgdefaultrendercontext.cpp Change-Id: I172c6fbff97208f21ed4c8b6db3d1747a889f22b
| | * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-041-4/+10
| | |\ | | | | | | | | | | | | Change-Id: I48764527fa1ab6d8d59c24552394459b1cdc58ee
| | | * Fix crash with window-less QQuickItemsSimon Hausmann2016-09-301-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark QQuickItem visual children directly in QQuickItem instead of relying on the item being a (grand) child of a window. [ChangeLog][QtQuick] Fix crash with QQuickItems created via JavaScript being garbage collected sometimes when they're not assigned to a window. This may happen even in qmlscene when between the creation of the root item and the assignment to the QQuickWindow the garbage collector runs. The previous approach of a persistent in QQuickView marking the visual item hierarchy relies on the existence of a view. The only thing left to do in the view and qml window implementation is enforcing the CppOwnership policy set on the content item in QQuickWindow by ensuring the presence of the JS wrapper, replacing the persistent with a weak value. This also introduces a new internal mechanism for QObject sub-classes to provide their own V4 JS wrapper types. Task-number: QTBUG-39888 Change-Id: Icd45a636a6d4e4528fc19165b13f4e1ca7967087 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | | QQmlPropertyData: use const APIs moreAnton Kudryavtsev2016-10-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. This change was here, but 86a55cdb8cb850066e1dcc288d2dddf600652994 re-introduced issue. Change-Id: Ica27cde6f7fbed881f4afa2fa7079aa30c3c1c1c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | QQmlPropertyCache: remove reduntant check ptr with nullptrAnton Kudryavtsev2016-10-171-2/+2
|/ / / | | | | | | | | | | | | | | | | | | ... before deleting. Change-Id: Ifa6b61a03376e42d3455416c3d977f74d6b7cf48 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Use the stringData() function from qmetaobject.cppThiago Macieira2016-09-121-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | It does some extra checking. This adds a comment so that we won't forget to update it if the source changes too. Change-Id: I9093948278414644a416fffd14730eb6b8dfe585 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Obliterate QQmlAccessorsErik Verbruggen2016-08-301-21/+1
| | | | | | | | | | | | | | | Change-Id: I70a080feb401cf23aef1bde44a19a11e27642f30 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Switch from using accessors to static_metacallErik Verbruggen2016-08-241-16/+18
| | | | | | | | | | | | | | | Change-Id: I7a781eb3cb0af9c68b385af5752555bd9cb313d4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Remove hasAccessors flag from QQmlPropertyRawDataErik Verbruggen2016-08-181-1/+0
| | | | | | | | | | | | | | | | | | | | | We can now always check if the pointer is null (no accessors) or not. Change-Id: Ie9abf2f8930ea1f75a6d637a47f7f9c4fbab1151 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Get rid of propTypeName in QQmlPropertyRawDataErik Verbruggen2016-08-171-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | This information can be recreated when needed: the property/method index is known, just like the meta-object, so we can query that for the type name. Change-Id: I9d4f557eda4e4a946a80b68d3787823767b0b1d3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Make all fields in QQmlPropertyRawData privateErik Verbruggen2016-08-101-108/+107
| | | | | | | | | | | | | | | | | | | | | | | | And add accessors. This makes it easier later on to change the storage of the fields. Change-Id: I21163668ac83a7d52f398981baf3c27ef161c177 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Qml: optimize string usageAnton Kudryavtsev2016-08-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use QStringBuilder more. Use QString::asprintf instead of arg()'s chain. Use += operator to reserve extra capacity for possible free following append/prepend/+= call. Change-Id: Ib65398b91566994339d2c4bbfaf94e49806b7471 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Qml: use const (and const APIs) moreAnton Kudryavtsev2016-08-091-3/+3
| | | | | | | | | | | | | | | | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: I13e4d5b091877319984c1ddaed4da8dc59a7c0a3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | QQmlPropertyCache: remove unused varAnton Kudryavtsev2016-08-081-1/+0
| | | | | | | | | | | | | | | | | | Change-Id: I2d2085e2df51efcb8ea3b24127a06632eca839ff Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QQmlPropertyCache: remove unused method propertyNames()Anton Kudryavtsev2016-08-081-8/+0
| | | | | | | | | | | | | | | Change-Id: Ibcae6b396677c5d4648f59a4c5998a08862cb033 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Change the property data flags into a bit fieldErik Verbruggen2016-08-051-76/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | This will make it easier in follow-up patches to add or remove flags. It also shrinks the flags, because each type doesn't need its own bit (as those are mutually exclusive). Change-Id: I5ba6de5f330eb20c82aa16b4467ed6c952725979 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Fix android buildOlivier Goffart2016-08-041-0/+1
| | | | | | | | | | | | | | | Change-Id: Id65119bef515c9b6336a343f39541f557a00e015 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Add a checksum to QQmlPropertyCacheSimon Hausmann2016-08-011-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | By running an md5 hash over the meta-object data and string tables this will allow us to detect changes to meta-objects and invalidate QML disk caches. Change-Id: I15b92de4cdf0cb525281b86e1c7b8ba0b11347a0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Add a function to QQmlPropertyCache to calculate the meta-object sizesSimon Hausmann2016-08-011-0/+167
| | | | | | | | | | | | | | | | | | | | | | | | This will be used later for calculating checksums of the meta-object data. Change-Id: Iba925eae298cbfc7b89196f4dd6fb2854ce75e2e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | QML: QQmlPropertyCache: prevent repeated QMeta* callsErik Verbruggen2016-07-141-11/+17
| | | | | | | | | | | | | | | | | | | | | By "caching" the (constant) results in the methods. Change-Id: I17e99c4fb902619cc1fe21ef772c8d1772ba9428 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: QQmlPropertyCache: Allow for more inliningErik Verbruggen2016-07-131-68/+0
| | | | | | | | | | | | | | | | | | | | | These are simple and often-called methods. Change-Id: Id681c75e13ec262c17dc00ce9f3a0c30c9183991 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>