aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycache.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix QProperty property interaction with aliasesFabian Kosmale2020-10-121-0/+1
| | | | | | | | | | | | | | | | With this change, an alias of a bindable property is also bindable, and shares its bindable interface with the target. Moreover, the logic in QQmlTypeCompiler is adjusted so that a change handler of an alias uses the bindable interface if possible, instead of connecting to the alias' change signal. That would never be emitted if the target is a QProperty without a notify signal. Alias properties still have a change signal, but those never get emitted. Change-Id: I857dfdbe51048a2b604ad632982e7f4adac6b907 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Avoid various warnings about deprected QMetaType methodsUlf Hermann2020-09-161-4/+4
| | | | | Change-Id: I8f4b2703fdd08ff341904219cec33c321e0511c7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@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>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-161-4/+4
| | | | | | | | Task-number: QTBUG-84319 Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Adapt to metaobject changesFabian Kosmale2020-06-121-29/+7
| | | | | Change-Id: I31dd544e80b8b2f8745463450a05fa7effafa8cd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add a wrapper class for the meta object in the property cacheLars Knoll2020-06-081-17/+7
| | | | | | Change-Id: Ie324f0bd29ff3df5528682d3bc135a28ca1b597f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Adapt to new MetaObject revisionUlf Hermann2020-06-041-6/+4
| | | | | | | The number of ints per method has increased. Change-Id: I1142abd969724e7c35fedbf6e849eab3ec90be26 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Consistently use pointers for the local variant in findPropertyUlf Hermann2020-05-261-8/+8
| | | | | | | | Creating property data on the fly shall be optional, and we generally use pointers for such "output" parameters. Change-Id: I0e4c6c079381b60140971f4fd70a25d6548323eb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* PropertyCache: Fix resolution of forbidden QObject methodsUlf Hermann2020-04-281-1/+3
| | | | | | | | | Despite best intentions the code still hid methods of gadgets when those were derived from other gadgets. Pick-to: 5.15 Change-Id: I787300b2a22d6557608772d218e73b9af6f79652 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add support for binding directly to QProperty instancesSimon Hausmann2020-03-301-0/+1
| | | | | | | | | | 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>
* Encapsulate QQmlContextDataUlf Hermann2020-03-231-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class is not a private detail of QQmlContext. And it is incredibly hard to see who owns what in there. Let's add some civilization ... We enforce refcounting for QQmlContextData across the code base, with two exceptions: 1. QQmlContextPrivate may or may not own its QQmlContextData. 2. We may request a QQmlContextData owned by its parent QQmlContextData. For these two cases we keep flags in QQmlContextData and when the respective field (m_parent or m_publicContext) is reset, we release() once. Furthermore, QQmlContextData and QQmlGuardedContextData are moved to their own files, in order to de-spaghettify qqmlcontext_p.h and qqmlcontext.cpp. When the QQmlEngine is deleted, any QQmlComponents drop their object creators now, in order to release any context data held by those. Before, the context data would be deleted, but the object creators would retain the dangling pointer. [ChangeLog][QML][Important Behavior Changes] QQmlContext::baseUrl() does what the documentation says now: It prefers explicitly set baseUrls over compilation unit URLs. Only if no baseUrl is set, the CU's URL is returned. It used to prefer the CU's URL. Change-Id: Ieeb5dcb07b45d891526191321386d5443b8f5738 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlPropertyCache: Avoid costly string comparisonFabian Kosmale2020-03-181-1/+1
| | | | | | | | The qqmlecmacsript required changes, because the call to id makes the type now known to the QML engine. Change-Id: I73aed804ae8769c71676b44d8450e1dabf5baa6d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Adapt to the the new QMetaType changeOlivier Goffart2020-03-091-12/+10
| | | | | | Fixes: QTBUG-82453 Change-Id: I7e5682945a07c3af183becd3947a69568f139d16 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlPropertyCache: Don't populate allowed revisions with invalid onesUlf Hermann2020-02-171-1/+1
| | | | | Change-Id: I1d39c9fc792bdb0240bfe12ad020ce4c8bb48454 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devSimon Hausmann2020-02-031-0/+13
|\ | | | | | | | | | | | | | | Conflicts: src/qml/common/qv4compileddata_p.h tests/auto/qml/qmlmin/tst_qmlmin.cpp Change-Id: Ieabc9e0729630de6a8644024d11b765f35199f29
| * Required properties: Do not fully resolve property cachesFabian Kosmale2020-02-031-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | There's no need to have the property cache fully resolved when checking for required properties, and it introduces bugs as information for fully resolving the type is missing at that point. This would later cause errors in the QQmlPropertyValidator, due to the propType being wrong. Fixes: QTBUG-81806 Change-Id: I413cc3fab57f258f5e4cf4164c505312b10543e2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In many places we carry major and minor versions or revisions that are loosely coupled to minor versions. As the Qt minor version resets now, we need to handle these things more systematically. In particular, we need to add a "major" part to revisions. QTypeRevision can express the current major/minor pairs more efficiently and can also be used to add a major version to revisions. This change does not change the semantics, yet, but only replaces the types. Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-301-0/+1
|\| | | | | | | Change-Id: I1e1d9585d876a8eacd4c24afc894a33075f51a13
| * Handle required properties declared in C++Fabian Kosmale2020-01-281-0/+1
| | | | | | | | | | | | Fixes: QTBUG-81561 Change-Id: I97a0f5013b6e3662ffaad53c5cc871404e11a310 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-251-16/+16
|\| | | | | | | Change-Id: Icb61522fb41a35303bb3d201b344a0407f67f9a0
| * QQmlPropertyData: Save some bitsFabian Kosmale2020-01-231-16/+16
| | | | | | | | | | | | | | | | | | | | There are some flags which are only used when the type equals FunctionType and respectively some which are only used when the type does not equal FunctionType. By reusing those bits and changing there semantics depending on type, we can grow BitsLeftInFlags by 50%. Change-Id: I7099d6e87826a49aae5f283160c488004ac5b0e1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-201-4/+4
|\| | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlvaluetype.cpp tests/auto/qml/qml.pro Change-Id: I78f992f83212bb9fd5e09b64163f15f046185224
| * Replace QVariant::type with QVariant::userTypeOlivier Goffart2020-01-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | as type is going to be deprecated. This change was done automatically with the help of clazy. In addition, ColumnRoleMetadata was changed to take an int instead of a QVariant::Type Change-Id: Ibc02d7b52e7d931a56c19fdebc4788b5e6df2a39 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Make QtQml work with the latest changes in qtbaseLars Knoll2020-01-141-7/+4
|/ | | | | | | | | | | | Adjust the code to work with the new QString and QVector data structures that have inlined size and data pointers. Fix a large bunch of compiler warnings from QFlags. Update dependencies for qtbase and qtsvg Change-Id: Iba237aed90c140b822e0cf501b9fb7156ec27c2d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add support for C++ accessible typed parameters and return types in qml ↵Simon Hausmann2019-07-091-3/+4
| | | | | | | | | | | | functions These can be declared using the new typescript-like syntax and using type names that are also used for signal parameters and property types. This merely affects their signature on the C++ side and allows the corresponding invocation. Change-Id: Icaed4ee0dc7aa71330f99d96e073a2a63d409bbe Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* 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>