aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycache.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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>
* | | QML: Clarify a parameter's usage in QQmlPropertyCacheErik Verbruggen2016-07-061-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Qml: replace QStringLiteral with QL1SAnton Kudryavtsev2016-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... or with QL1C in such cases: - if there is overloaded function - in QStringBuilder expressions Saves ~1.5 KB in text size. Build config: ubuntu 16.04 x64, gcc 5.3 Change-Id: Icc0789f1c244ce20a3182494b0c7f35c9d77e41d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Add QJSEngine::newQMetaObjectCorentin Jabot2016-06-051-27/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QJSEngine::newQMetaObject let us expose QMetaObject to the QJSEngine, allowing to construct QObjects instance from javascript. Additionally, enums values are exposed as property of the QMetaObject wrapper. (The engine takes ownership of the created objects) Change-Id: I5428d4b7061cceacfa89f51e703dce3379b2c329 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Fix bug in designer support reference countingSimon Hausmann2016-05-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QtQuick designer support may override the meta-object and reparent the property-cache of the object under editing. The code for replacing the parent of the property cache however was not handling the refcount of the _parent correctly. Change-Id: Ic73294fc208b297e8ec9c0b775b5da01a309dba6 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | | Introduce delegating constructors.Friedemann Kleint2016-05-061-4/+1
|/ / | | | | | | | | | | | | Reduce code duplication by chaining constructors. Change-Id: I8a0afd20ed13d4eb938536dcb05787ba2565a4cc Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | QML: allow more methods to get inlined.Erik Verbruggen2016-04-051-21/+0
| | | | | | | | | | | | | | | | Most of these methods are small, and all of them lie in the 'hot path' for simple bindings like 'width: parent.width'. Change-Id: I0071cec92b49437a352160b0283ed6c89a278a07 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QQuick: remove property index from the accessor functions.Erik Verbruggen2016-03-311-1/+0
| | | | | | | | | | | | | | This parameter was not used. Change-Id: I1e8c0994cad37fc24105e354a80a4fb0131d58ee 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>
* Libraries: Fix single-character string literals.Friedemann Kleint2015-10-131-3/+3
| | | | | | | Use character literals where applicable. Change-Id: I294fc4cb5cbbd23df9735ba2b398118f37cbe08a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Smaller cleanupsLars Knoll2015-09-251-5/+3
| | | | | Change-Id: Ib75bf9de898975dcbb98b411a1e98524754c0788 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Remove some unused codeLars Knoll2015-09-251-129/+0
| | | | | Change-Id: Iaa89515891624602cf63701364c77e49ea1e1bd9 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Hold a pointer to the QV4::ExecutionEngine in the property cacheLars Knoll2015-08-191-10/+10
| | | | | | | This makes more sense than a pointer to the QQmlEngine. Change-Id: Ic6037b0df63b6cf1585539bc3ac78822f0e69d02 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-181-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/debugger/qv4debugservice.cpp src/qml/jsruntime/qv4value_inl_p.h src/qml/jsruntime/qv4value_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/qml/qqmlnotifier_p.h src/qml/qml/qqmlproperty.cpp src/quick/items/qquickflickable.cpp src/quick/items/qquicktextedit.cpp tests/auto/quick/qquickwindow/BLACKLIST The extra changes in qqmlbinding.cpp are ported from changes to qqmlproperty.cpp that occurred in parallel with writeBinding() being moved to qqmlbinding.cpp. Change-Id: I16d1920abf448c29a01822256f52153651a56356
| * QtQml: Fix const correctness in old style castsThiago Macieira2015-07-091-1/+1
| | | | | | | | | | | | | | Found with GCC's -Wcast-qual. Change-Id: Ia0aac2f09e9245339951ffff13c958364a2e9859 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Clear stringCache explicitly instead of asserting its emptiness.Dmitry Volosnykh2015-06-251-2/+1
| | | | | | | | | | | | | | | | | | This assumption does not hold when PathView's path.pathElements list is updated with new contents at runtime. Task-number: QTBUG-46255 Change-Id: I6b0d7ee8ee2d67ca0138eacdf0ad221338f788e4 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* | Get rid of qv4value_inl_p.h and replace it by qv4typedvalue_p.hLars Knoll2015-04-241-1/+1
|/ | | | | | | | This is a cleaner separation and further reduces include dependencies in the definitions of our basic data structured. Change-Id: I18aa86cdea0c0dfbc16075d4d617af97e638811e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* QtQml: Micro-optimize iterator loops.Friedemann Kleint2015-02-261-2/+2
| | | | | | | Avoid repeated instantiation of end() in loops, use variable instead. Change-Id: I3bb1c6918cfd16a5dcefbcc03c442e99fe9bf76b Reviewed-by: Erik Verbruggen <erik.verbruggen@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>