aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycache_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Dissolve QQmlPropertyRawDataLars Knoll2019-04-181-11/+11
| | | | | | | There is no reason anymore to split the class in two parts. Change-Id: Iabef7acec1db7afc0ed4e89e1fd5b78699dc0847 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Move propertyCache-by-minor-version into QQmlMetaTypeDataUlf Hermann2019-04-181-2/+0
| | | | | | | | | | | | Ths data structure should only be accessed when protected by the metatype data lock. In fact we don't access it from anywhere else. To make that more obvious, move it to the right place. This allows us to eliminate some const_cast and poking around in QQmlTypePrivate from the outside. Change-Id: I16ffd240b9504b9c00010bdb2d17b05c8196fe8a Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-02-251-3/+3
|\ | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlmetatype.cpp Change-Id: I517c001ea4eb0fdd8e469f9fffe5b7559a5b0795
| * QML: Pass type minor version when creating property dataUlf Hermann2019-02-211-2/+2
| | | | | | | | | | | | | | | | | | 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/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Add public methods to query and set allowed revisions of property cachesUlf Hermann2019-02-071-1/+4
| | | | | | | | | | | | | | We should not poke around in the private objects for this. Change-Id: If7089848d8310700a5a84efb0ff9b753a7de1f97 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Split QStringHash and QLinked(Multi)StringHash apartUlf Hermann2019-02-071-2/+2
| | | | | | | | | | | | | | | | The plain QStringHash can have a mutable iterator. The linked one can not. We never use a non-linked MultiStringHash. Change-Id: I69b66f7952e6e47b79c0995f389e6219744dfc76 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Move QStringHash into its own fileUlf Hermann2019-02-061-1/+1
| | | | | | | | | | | | | | QHashedString and QStringHash are different things. Change-Id: Ifcac58ef41bf15dd6172fa0c42b86eca385c2ce0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Remove outdated methodUlf Hermann2019-02-041-2/+0
| | | | | | | | | | Change-Id: I457dc9384653e973e96cb393c45285afe215808d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QML: Split propertyCache into multiple filesUlf Hermann2019-02-011-600/+4
|/ | | | | | | I want to be able to read the code. Change-Id: I063143ff63b0a476d783c892e1d328e7f5133fab Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up manual reference of QQmlTypeData and QQmlPropertyCacheSimon Hausmann2018-04-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | We have a few places in the type loader where we do adventurous manual reference counting, where getType() returns a raw pointer that has been addref()'ed and then sometimes somehow we call release() later. Commit 0b394e30bba4f6bb7e6f7dbe5585a2e15aa0f21d is an example of where this can easily go wrong. As a consequence and also in preparation for future work on the type loader, this patch starts replacing the manual reference counting there. Changing the return type from QQmlTypeData *getType() to a QQmlRefPointer<> itself is not sufficient though, as the implicit operator T*() will still allow the caller to store the result as a raw pointer. Therefore this patch removes the "unsafe" implicit extraction operator. As a result of that change, other types that are sometimes stored in QQmlRefPointer are also affected and their usage needs to be adapted to QQmlRefPointer usage or manual raw pointer extraction with .data(). Change-Id: I18fd40634047f13196a237f4e6766cbef3bfbea2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Initialize all members of QQmlPropertyDatav5.11.0-beta2Lars Knoll2018-03-081-9/+10
| | | | | | | This lead to quite a few valgrind warnings in test cases. Change-Id: Icef0fc5f93a68e4fe67e1ecd4755b456ad4778a9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* use the override keyword consistently and correctly (clang-tidy)Shawn Rutledge2018-02-271-1/+1
| | | | | Change-Id: If9e28d143f8cba3df3c757476b4f2265e2eb8b2a Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* init variables where they are declared when possible (clang-tidy)Shawn Rutledge2018-02-261-2/+2
| | | | | | | | clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-12/+12
| | | | | | | | | | | | | 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>
* Remove unnecesary checksJesus Fernandez2018-02-071-2/+0
| | | | | | | | | | | | | | CID 186959 (#1 of 1): Macro compares unsigned to 0 (NO_EFFECT) unsigned_compare: This greater-than-or-equal-to-zero comparison of an unsigned value is always true. rev >= 0. CID 186960 (#2 of 2): Operands don't affect result (CONSTANT_EXPRESSION_RESULT) result_independent_of_operands: rev <= 255 /* std::numeric_limits<unsigned char>::max() */ is always true regardless of the values of its operands. This occurs as the logical first operand of ?:. Coverity-Id: 186959 Coverity-Id: 186960 Change-Id: Iaadadb89de1c8732b2756da8fda397632b6b7d93 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* Allow exported signal handlers for signals with revisionThomas Hartmann2018-01-121-7/+34
| | | | | | | | | | | | | | | 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-13/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Remove QQmlEnginePrivate::typePropertyCacheSimon Hausmann2017-08-021-0/+1
| | | | | | | | | | | | | | | | | | Instead of maintaining a hash per QQmlType and minor version, move the version specific property caches into QQmlType. Task-number: QTBUG-61536 Change-Id: I72f3990cb93e64ac5074060b4ff327043eab7966 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Move property cache from the engine to QQmlTypeSimon Hausmann2017-08-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Now that the property cache is independent of a specific engine, we can cache them in QQmlType instead of caching them per engine. This simplifies the logic and avoids duplicated property caches when multiple engines are running. Task-number: QTBUG-61536 Change-Id: I6f082e1e7495ae0f5b92559e8d0a3437c56e303a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Move the engine pointer from the property cache to the VME meta objectLars Knoll2017-08-021-13/+5
| | | | | | | | | | | | | | | | | | 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/+32
|/ | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-11-231-0/+2
|\ | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4object_p.h Change-Id: Iff4d3aba7710a999b8befdc493cbe959e1ce02f9
| * QML: Add another specialization for QQmlPropertyCache::propertyErik Verbruggen2016-11-161-0/+2
| | | | | | | | | | | | | | | | | | 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: add property() overload with QStringRef argAnton Kudryavtsev2016-11-081-1/+7
| | | | | | | | | | | | | | | | 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 devJ-P Nurmi2016-11-031-2/+2
|\| | | | | | | | | | | | | Conflicts: tools/qmljs/qmljs.cpp Change-Id: Ifa9e74bdb780eaff22fbc9ba1c514d0078a3fb29
| * QML: Hint LTO to never inline QQmlPropertyCache::resolveErik Verbruggen2016-10-251-2/+2
| | | | | | | | | | | | | | | | ... so the fast-path doesn't get bogged down by accidental slow-path inlining. Change-Id: Ifb3eadf5e96b5a61f41fb1f0d32269e43f13be57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-181-0/+14
|\| | | | | | | | | | | | | | | | | | | 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-0/+14
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+16
| | |\ | | | | | | | | | | | | Change-Id: I48764527fa1ab6d8d59c24552394459b1cdc58ee
| | | * Fix crash with window-less QQuickItemsSimon Hausmann2016-09-301-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Qml, Imports: mark some methods as constAnton Kudryavtsev2016-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These methods do not modify objects. Change-Id: I67b1a10cfd0b32688500fca3265a96f53afd1b57 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | | Qml: add missing 'override'Anton Kudryavtsev2016-10-071-2/+2
|/ / / | | | | | | | | | | | | | | | | | | ... and drop redundant 'virtual' Change-Id: Ib1f68c1ebd0468cb4a77eecc986bbf718f6bf789 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | QML: Obliterate QQmlAccessorsErik Verbruggen2016-08-301-5/+0
| | | | | | | | | | | | | | | Change-Id: I70a080feb401cf23aef1bde44a19a11e27642f30 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Switch from using accessors to static_metacallErik Verbruggen2016-08-241-21/+46
| | | | | | | | | | | | | | | Change-Id: I7a781eb3cb0af9c68b385af5752555bd9cb313d4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Remove hasAccessors flag from QQmlPropertyRawDataErik Verbruggen2016-08-181-5/+2
| | | | | | | | | | | | | | | | | | | | | 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: Change storage types of QQmlPropertyRawData fieldsErik Verbruggen2016-08-181-41/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By getting rid of the unions, all "features" (like accessors and notify indices) can now be used for all properties or functions. Other fields are trimmed to the size as used in other parts of QML. Now the size of QQmlPropertyRawData is 24 bytes on 32bit platforms, and 32 bytes on 64bit platforms. Change-Id: Ie2f22eb60e6119c93e3d3ea32a2974a718d45e91 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Get rid of propTypeName in QQmlPropertyRawDataErik Verbruggen2016-08-171-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Move flag from QQmlPropertyRawData fields into its flagsErik Verbruggen2016-08-111-9/+8
| | | | | | | | | | | | | | | Change-Id: I4f1aaf92fd1c67ec18ab0f80d6d0bf58b4af6a17 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Make all fields in QQmlPropertyRawData privateErik Verbruggen2016-08-101-75/+123
| | | | | | | | | | | | | | | | | | | | | | | | 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: Split off value type information from property dataErik Verbruggen2016-08-091-42/+6
| | | | | | | | | | | | | | | Change-Id: I2ae2fb0f18af9b866cc9482fd4f42d9d4269f8cb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QQmlPropertyCache: remove unused method propertyNames()Anton Kudryavtsev2016-08-081-1/+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-90/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | QML: Introduce QQmlPropertyIndexErik Verbruggen2016-08-041-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | This helps in making it clear when an index is a plain old number and when it consists of an encoded value type index. Change-Id: Ic50d95caf244ed0ee2d62bdba53910a371cfee04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Add a checksum to QQmlPropertyCacheSimon Hausmann2016-08-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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: Unify property reads/writes and use accessorsErik Verbruggen2016-07-251-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | Pass property reads/writes through utility functions in QQmlProperty, which in turn will try to use accessors when available (and no interceptors have to be called). Change-Id: I60ecfc202b6024bfe4a33206a46299787b152546 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Split out creation of alias properties in the property cachesSimon Hausmann2016-07-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to the regular property cache creation code, this also has to become a template function so that it can be run on the compilation units loaded from disk in the future. What is shared between the code path of a fresh compilation vs. re-use of a unit from disk is the code to propagate the CompiledData::Alias entries into entries in the property cache. The code for iterating through the component spaces and resolving the alias references is not shared. Change-Id: I04c2a5575310400156b457ae7b709cffecb7455e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QML: QQmlPropertyCache: Allow for more inliningErik Verbruggen2016-07-131-0/+66
| | | | | | | | | | | | | | | | | | | | | These are simple and often-called methods. Change-Id: Id681c75e13ec262c17dc00ce9f3a0c30c9183991 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Clarify a parameter's usage in QQmlPropertyCacheErik Verbruggen2016-07-061-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Give the template type a fitting name, use a parameter name that is slightly more descriptive than "dummy", and pass it around by pointer like we do in other places. Change-Id: Ie7051a6053fc8d2f9c3ea92ee3ce18e57dc5e62a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>