aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycache.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | 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>
* Fix compiler warning about use of uninitialized variableLars Knoll2015-01-101-0/+1
| | | | | Change-Id: Ic9218d82c5f47d464a6536759cfe2c6dbfc9f985 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* QML: fix uninitialized variable use.Erik Verbruggen2015-01-091-0/+1
| | | | | | | | | | | | /Users/erik/dev/qt5-dev/qtdeclarative/src/qml/qml/qqmlpropertycache.cpp:1539:5: warning: variable 'offset' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] default: ^~~~~~~ /Users/erik/dev/qt5-dev/qtdeclarative/src/qml/qml/qqmlpropertycache.cpp:1544:15: note: uninitialized use occurs here *index -= offset; ^~~~~~ Change-Id: I92538c8a3cf2a192be4c62e29b06b2c940b6def5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* The property() calls in the proeprty cache only require a QJSEngine nowLars Knoll2015-01-081-4/+4
| | | | | Change-Id: Ic4a944b4f1dd02ad2f0284acad5f3135068f66df Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix property access and method invocation on value types that use inheritanceSimon Hausmann2015-01-071-2/+38
| | | | | | | | | | For gadgets/value types we use moc's static_metacall, which doesn't call the parent class implementation. Therefore before placing a static metacall we must resolve the indicies and find the right meta-object. Change-Id: I258e3d9ecfc704498c68772dc42b16134a3bfd83 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Make QQmlPropertyCache available in QJSEngineSimon Hausmann2014-12-291-7/+6
| | | | | | | | | The QQmlEngine has two containers for property caches, one for QML types and one for all-purpose meta-objects. The latter is rather useful and now being moved to QJSEngine to be available there. Change-Id: Ieab65c400b8a2e410e5f9eee6d603162dbb864d9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Prepare for QQmlPropertyCache to become available in QJSEngineSimon Hausmann2014-12-291-21/+17
| | | | | | | | | The cache is seemingly tied to QQmlEngine, but it isn't. A lot of times a QQmlEngine parameter is unnecessarily dragged around and the engine member is option as well as it turns out. Change-Id: Iffd2a5046e9785249689ebfcbc8a0ad509f76aea Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Prepare method invocation in QObject bindings for gadget supportSimon Hausmann2014-12-231-0/+8
| | | | | | | | | | In order to support calling invokable methods in gadgets from JavaScript, the wrapper code needs to be able to operate on gadgets and not only QObject pointers. The minimal abstraction for that - QQmlGadgetOrObject - is passed through the relevant invocation methods in the wrapper for that. Change-Id: I94f939c942241f49dce4d32d05bf24822b2d331b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move methodParameterTypes and methodReturnType helper functionsSimon Hausmann2014-12-231-140/+131
| | | | | | | | | | | | | These can extract the type information from either a property cache (through QQmlData from a QObject) or (fallback) from a QMetaObject. The difference between a QMetaObject and a QQmlPropertyCache is what QQmlMetaObject abstracts and therefore we can move the functions there. This is in preparation for gadget support and also avoids the repeated QQmlData::get() dance but allows the re-use of a QQmlMetaObject instance in the future to do that dance only once. Change-Id: Ibff6ce498d09fabc97e0801653edc5b1ff446c6a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Read and write QObject pointer properties in QML without registration.Mitch Curtis2014-12-131-1/+23
| | | | | | | | | | | | | | Previously, accessing QObject pointer properties from QML would require these types to be registered with qRegisterMetaType(), but this shouldn't be necessary if we're able to read/write the property, because the moc generates code that calls qRegisterMetaType in the static meta-call implementation. So when resolving a property in the property cache and we can't resolve, fall back to placing the static meta-call to register the type, similar to what QMetaType::userType() does. Change-Id: Ic8b00ed93a1e5e42cf7aaaf1c355e89557485c59 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Fix QQmlPropertyCache population with gadgetsSimon Hausmann2014-12-121-2/+6
| | | | | | | | | | | | | The property cache excludes the destroyed() signals as well as the deleteLater() slot from the accessible methods. It does that by comparing the method index against the indices of these signals/slots, which works as long as every meta-object is through some way derived from QObject's meta object. However that's not the case for gadgets, where these indices don't apply and will instead accidentally hide methods. Change-Id: I5f2b3f578192ff0df607af67832389c30bb11beb Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@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>
* Make QQmlPropertyData::name constAlbert Astals Cid2014-03-031-2/+2
| | | | | Change-Id: Idfa52f625fd116b9fc858bb383a1ee17b3ff3e66 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix nasty bug in property cache leading to inaccessible signal parametersSimon Hausmann2014-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | The property cache among other things caches the parameter types and names of signals (instead of retrieving them from the meta-object each time). When this cache is created through createArgumentsObject(), the parameter names have to be provided, but the signature didn't enforce that because of the parameter names having a default value of an empty list. All call sites however provided the correct list, except for one in QQmlPropertyCache::methodParameterTypes. Consequently tst_qqmlecmascript::threadSignal() would fail occasionally because the first time this cache was "created" was when the "done" signal was emitted, which caused QQmlBoundSignalExpression::evaluate to call methodParameterTypes. If the signal data had not been cached so far, a new cache with an empty parameter name list was created. Later (in the second half of the test) a new signal handler was compiled and the property cache reported that the signal took no parameters. Change-Id: I19230d0fb1ddd54992f3d6251f82c489626662e7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Rename some filesLars Knoll2014-01-311-1/+1
| | | | | | | | | | | | Rename qv4value_def_p.h -> qv4value_p.h and qv4value_p.h to qv4value_inl_p.h. It makes more sense to have the class definition in the file that is named after the class and move the inline methods into a _inl file. Doing this now, as I expect we'll be needing a few more _inl files soon. Change-Id: Ib59e9380e9e976254c6b4369574157f39b1b5f51 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Clean up handling of illegal names and enable in new compilerSimon Hausmann2014-01-061-1/+1
| | | | | | | | | | Access to the identifier hash may not be thread-safe from the loader thread, so use a QSet copy instead (which is cheap because we don't detach). This also enables the checking for illegal types again. Change-Id: I8c3ec1fd0fc01cce3269e206f479a90bdbbc89dd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-041-1/+1
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix performance regression when doing property lookups for non-existant ↵Simon Hausmann2013-10-161-2/+1
| | | | | | | | | | | | | | | | | properties Commit 84627464eb11ca1149d46946b12e3c82eb54a8bf introduced a performance regression of falling back to reading the QMetaObject, when the lookup for a property in QML failed, after we've tried in the property cache. This is very very expensive to do and was only due to QQmlPropertyMap not correctly invalidating the property cache. Instead remove the property cache from the property map's QObject and on the lookup side rely on the property cache being correct in the result (positive or negative). Change-Id: I8a013483203f2007d48b71feafa10b3ea02c53fd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove qSort usages from declarativeGiuseppe D'Angelo2013-09-131-2/+3
| | | | | | | | | QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I8fa7d0186cc8f0ba562695974829e37f1eb87f2f Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make it possible to handle pointers to QObject derived in QML.Stephen Kelly2013-09-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This way, properties of QObject derived types can be read in QML code for example: Q_PROPERTY(MyObject* obj READ obj CONSTANT) Previously, only QObject* types could be read by QML: Q_PROPERTY(QObject* obj READ obj CONSTANT) This meant that multiple properties and methods had to be created for classes which were relevant to both QML and non-QML code. This patch lifts that restriction. As a consequence, we can also remove a Q_EXPECT_FAIL from the qqmllanguage unit test. That test was introduced in commit 92562eacbc3c (Allow signal parameters which are custom QML object-types, 2012-07-13) to document knowledge of the limitation while fixing it as much as possible. Task-number: QTBUG-26662 Change-Id: Ic85fa73c6f3655189438ec509765bae2eab9993a Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change access mode for functions declared in qmlCaroline Chao2013-09-101-1/+1
| | | | | | | | | | Give the method a QMetaMethod::Public access instead of a QMetaMethod::Protected one. This is valid and is also needed when using the qmlplugindump tool with composite types. Change-Id: Ie1660716d8767cdc949f04a2f324799f2d2fe6c5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Optimize lookups in the property cacheLars Knoll2013-08-051-3/+3
| | | | | Change-Id: I0df182a18ab35ad8744fd23243286c7c501cd4a9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Revert partially "Remove some unused code and forward declarations"Marco Bubke2013-07-181-0/+5
| | | | | | | | | The setParent function was used by the qml designer! This reverts commit 8cb3b016885a861fcd2af24e559e768eabecc3ae. Change-Id: Id6236f5f27d0bf997c5670f3431cfd43721f380b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix regression in tst_qqmlecmascript::signalAssignmentSimon Hausmann2013-07-051-2/+75
| | | | | | | | | | Detect errors in the signal declaration already at compile time, re-introducing the earlier code in qqmlcompiler.cpp that checked that. This also means that the parameter string construction can be done once for each signal and not for each handler. Change-Id: Icf6242a793939466bbc44d43bf041281164ad1b6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of the signal expression rewriterSimon Hausmann2013-07-031-55/+0
| | | | | | | | | | | | | This replaces the entire rewriter with more or less: expressionToEval = "(function(<named params here>) { " + expr + " } )" This also fixes crashes at run-time when the signal rewriter was executed from the loader thread and tried to use a v4 identifier hash with the same engine that's also in the main thread. Change-Id: Ib1e4927d330706a593411fbff64ed3da1e23d0e0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Convert QV8Engine::illegalNames() to use the identifier hashLars Knoll2013-06-281-1/+1
| | | | | Change-Id: I436c2a17e417cb311f10290a4cc6e5b728b4b7be Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove some unused code and forward declarationsLars Knoll2013-06-281-13/+2
| | | | | Change-Id: I2ab2818159c60b199cae4f7573ea47b01a178e7b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of QHashedV4StringLars Knoll2013-06-281-6/+6
| | | | | | | | This was required while we were using V8, but now we can simply pass QV4::String pointers. Change-Id: If6338e4a455d6132fe14e5e603e4fe9e477d1ffb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into ↵Simon Hausmann2013-06-241-20/+31
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wip/v4 Conflicts: src/imports/qtquick2/plugins.qmltypes src/qml/debugger/qv8debugservice.cpp src/qml/qml/qml.pri src/qml/qml/qqmlcompiler.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlcontext.cpp src/qml/qml/qqmldata_p.h src/qml/qml/qqmlengine_p.h src/qml/qml/qqmljavascriptexpression.cpp src/qml/qml/qqmlxmlhttprequest.cpp src/qml/qml/v4/qv4bindings.cpp src/qml/qml/v4/qv4irbuilder.cpp src/qml/qml/v4/qv4jsonobject_p.h src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/qml/qml/v8/qv8bindings.cpp src/qml/qml/v8/qv8contextwrapper.cpp src/qml/qml/v8/qv8listwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper_p.h src/qml/qml/v8/qv8sequencewrapper_p_p.h src/qml/qml/v8/qv8typewrapper.cpp src/qml/qml/v8/qv8valuetypewrapper.cpp src/qml/types/qqmldelegatemodel.cpp src/quick/items/context2d/qquickcanvasitem.cpp src/quick/items/context2d/qquickcontext2d.cpp sync.profile tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/benchmarks/qml/animation/animation.pro tools/qmlprofiler/qmlprofiler.pro Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
| * QQmlPropertyCache: check methods before propertiesAlberto Mardegan2013-05-311-21/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating the QQmlPropertyData, search within the methods list before searching for properties. The reason is that if the meta object is dynamic, looking up a property will always return a result (if the property doesn't exist, it will be created) and therefore all methods will be obscured. By swapping the search order, we eliminate this risk (methods are not dynamically added). Task-number: QTBUG-29836 Change-Id: Ie367f757c37ef4bc834a6c1c009f27bcf344fe76 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
| * Fallback to QMetaObject for properties not in QQmlPropertyCacheAlberto Mardegan2013-05-311-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | QQmlOpenMetaObject does not update the QQmlPropertyCache when new properties are added, meaning that the QQmlPropertyCache might not contain all of the dynamic properties of an object. Therefore, make QQmlPropertyCache fallback to reading the QMetaObject when a property is not found. Task-number: QTBUG-31226 Change-Id: I760aaa155b1952f6f52ab9ce173fb9547f8e34a6 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* | Cleanup: It's QQmlV4Function and so the flag should also be called ↵Simon Hausmann2013-05-221-2/+2
| | | | | | | | | | | | | | V4Function instead of V8Function Change-Id: I6d4d258e1fcad9097eb898f0b092f564cd4078ad Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Remove v8 dependencies in qhashedstringLars Knoll2013-05-221-4/+4
| | | | | | | | | | | | | | Also remove now unused API in v8::String Change-Id: I2570aedf407c89ad85da01cf0e2153a52b4e562d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix invocation of QQmlV4Functions in JS/QMLSimon Hausmann2013-05-151-2/+2
| | | | | | | | | | | | | | | | After the renaming of the class we also need to fix the two places where we refer to the type by name. Change-Id: I3c446cb31c2ecfc457f161f6b5cd7e30f44b2227 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Make the default constructor of PersistentValue not allocate a d pointerLars Knoll2013-05-071-3/+3
| | | | | | | | | | | | | | | | This is also required to change the v8::Persistent in QQmlData over to v4. Change-Id: Ib3164ded9c772e977f6b43ef6163a3aa74da3800 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Rename Value::deletedValue() to Value::emptyValue()Lars Knoll2013-05-071-3/+3
| | | | | | | | | | | | | | This reflects a bit better how this special value is being used. Change-Id: I136c8ab648bf82102fb2627e17c574a980c4d5ff Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>