aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycache.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | Convert QQmlPropertyCache to use QV4::persistentValue instead of the v8 versionLars Knoll2013-05-061-4/+3
| | | | | | | | | | | | | | | | The V4 persistent values are safer to use, as the v8 ones never implemented proper semantics when the engine gets deleted. Change-Id: I787f8c01c70828f22ac60f0ac25201cdfa5a617f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix conversion of values to QStringsLars Knoll2013-04-291-1/+3
| | | | | | | | | | | | | | | | Implement proper conversion to a QString without requiring an ExecutionContext. Change-Id: I6bcd3bcad0a32c483cea79ec1e1abac3b04d39e7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Rename QQmlV8Handle to QQmlV4HandleLars Knoll2013-04-191-2/+2
|/ | | | | | | | | The handle wraps a V4 Value, so this is the better name for it. Also added some accessor methods to convert to and from V4 Values. Change-Id: I327c83feb5bd3be59909001489979e5a3a9d9e67 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Stabilize CodeAlan Alpert2013-04-021-1/+1
| | | | | | | | | Apparently it is no longer necessary to rely on undefined compiler behavior. Change-Id: I8e93dc0de663713c714d7894f4c66acb0aec30b4 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Declare QJSValue as a metatype where it is defined.Stephen Kelly2012-12-041-2/+0
| | | | | | | Instead of in multiple different TUs, therefore causing ODR violations. Change-Id: I08d3624d3ed5a995e96488361665afa197fb9fc9 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Declare QQmlV8Handle as a metatype where it is defined.Stephen Kelly2012-12-041-1/+0
| | | | | | | Instead of in multiple different TUs, therefore causing ODR violations. Change-Id: Iefc5f3486961b91dd4e97a462f72570ff49bfd1b Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* QQmlPropertyCache: adding setParent()Thomas Hartmann2012-11-051-0/+5
| | | | | | | | | | | setParent() enables to dynamically set the parent of a QQmlPropertyCache. This is used in the Qt Quick Designer to create dynamic properties on an arbitrary object. Change-Id: I0dafabcacf4222fc1bfe693736cbd23e1e928e8f Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com> Reviewed-by: Marco Bubke <marco.bubke@digia.com>
* Adding invalidate function to QQmlPropertyCacheThomas Hartmann2012-10-231-0/+33
| | | | | | | | This is required for tooling to update a QMetaObject inside a running QQmlEngine. Change-Id: I26d3aeed57d39c361c150261c4e1a84094e6f657 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix property overriding lookup to exclude functionsv5.0.0-beta1Matthew Vogt2012-08-281-8/+28
| | | | | | | | Function overriding is required by QmlTest, and is likely to be used by other existing QML users. Change-Id: I04086a933456145bda5cede74aba753799feb555 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Refactor QQmlPropertyCacheMethodArguments creation.Michael Brasser2012-08-281-57/+21
| | | | | Change-Id: Ic7215741b26ddf0a36181cf7c7daaff095e797da Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Fix leak introduced in 0853343c33e394f35c31c161b019b2aed17f9256.Michael Brasser2012-08-281-6/+9
| | | | | Change-Id: I7e23f2ba8e7ecbcfaddce1ac4224434aa5fbe69b Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Restrict v8 property lookup to the execution contextMatthew Vogt2012-08-271-100/+140
| | | | | | | | | | | | | When resolving property names, only properties known to the current context of execution should be available. If a property name has been overriden by a component extension, code executing in the context of the base component should resolve the property name to the property available inside the base component or its bases. Task-number: QTBUG-24891 Change-Id: I9687cc28e108226d5a939627a901c8254344b598 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Avoid dynamic lookup of signal handler argumentsMichael Brasser2012-08-241-14/+128
| | | | | | | | | | | Rewrite signal handlers to include the parameters in the rewrite. Also check whether parameters are actually used when possible, and if not don't provide them to the expression. Change-Id: I7d65c05f4639979dd61035cf7478119ef7647c25 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com> Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Remove the use of QWidgetStar from QtQml.Stephen Kelly2012-08-151-2/+2
| | | | | | | | | The enum value can be removed so that it can be replaced in functionality with QMetaType::PointerToQObject. There is no advantage to QtDeclarative knowing that a value is a QWidget pointer. Change-Id: I14530132bc37fbb0dc55ba8aaa5bb68db0d87bad Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Trim trailing whitespaceStephen Kelly2012-07-171-13/+13
| | | | | Change-Id: Iafc5a94bb07c499b581bfec300d01e0fde165146 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Use V4 binding for non-final properties where possibleMatthew Vogt2012-07-091-0/+8
| | | | | | | | | When a property referenced in a binding is not marked as final, do not automatically abort optimization. Instead generate both V4 and V8 binidngs, and only fall back to the V8 binding if necessary at run time. Change-Id: I1bcc7e2b495935c5d519a9a223f640c1972cdb4e Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Don't AssertAlan Alpert2012-06-251-1/+2
| | | | | | | | | It's better to have run-time errors in certain uses of the property than to assert when trying to access it. Change-Id: I913eea3fe275ee41358ac8d56bd597faf8e613ad Reviewed-by: Chris Adams <christopher.adams@nokia.com> Reviewed-by: Andrew Stanley-Jones <andrew.stanley-jones@nokia.com>
* Support enum return types in Q_INVOKABLE functions.Matthew Vogt2012-06-221-0/+50
| | | | | | | | | Handle enums correctly when used as the return type of a Q_INVOKABLE function. Task-number: QTBUG-23543 Change-Id: I14a506ffee08f5ba6aa0fdf27d6104a3ae5c48b3 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* QtQuick: Fix warnings about unused variables.Friedemann Kleint2012-06-131-2/+0
| | | | | Change-Id: Ibe134810cc67e30a61b42ffa3be73f59c2ef96a2 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Adapt to connection-related changes in qtbaseKent Hansen2012-06-121-6/+45
| | | | | | | | | | | | | | | | | | | The QQmlData hooks signalEmitted() and receivers() now receive the index in the signal index range (i.e., excluding non-signal methods). This was done to avoid Q(Meta)Object having to compute the class's method offset; the signal offset should be sufficient for everyone. This required adapting QQmlNotifier, QQmlBoundSignal, QQmlPropertyCache and friends to use the signal index range whenever a property's notify signal is involved in the internal connection lists and property captures. Using the signal index range also reduces the memory used for NotifyList::notifies, since useless entries for non-signal methods will no longer be created. Change-Id: I62872fbea5a1f829b8b03bae3fc1e6acd84cf886 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Fix crash in lazy meta object generation.Aaron Kennedy2012-06-041-1/+1
| | | | | | | | | | | | | | | | Inside the property cache, override data can only handle overrides pointing to either a method or a property, but not to a signal handler. This is a bug in itself, but has never come up before due to no one following override data on methods. When this was changed by d2e557c2c2d7fcf3bf7c1676df3902e115986dc2, this bug was exposed. This change doesn't actually fix the underlying problem, but it does restore exactly the same behavior we had previously. The complete fix will come in a later change. Change-Id: I6a890e6ca1e40735da8158b21dfe38dc88091081 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Simplify method name extraction in property cacheKent Hansen2012-05-241-15/+9
| | | | | | | | All of Qt is now generating r7 meta-objects, so the compat support can be removed. Change-Id: Ib8e697b86a0ae8a68209fe661a8043505838f631 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Lazily create QMetaObjectsAaron Kennedy2012-05-241-47/+483
| | | | | | | | | | For internal QML built types, creating a metaobject each time is just wasteful. Additionally, as the property caches were always created from the intermediate QMetaObject, it was difficult to pass information directly from the compiler to the property cache. Change-Id: I769526b0edaaf16a86883f3065b75618b94e4077 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>