aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlbinding.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-07-281-1/+6
|\ | | | | | | Change-Id: I7d092cce33cb009d63e7b0df7c71183089dea53f
| * Rebuild QQmlData::propertyCache if deleted by another engineDavid Edmundson2017-07-131-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | QQmlData is shared between engines, but the relevant QObjectWrapper is not. Since 749a7212e903d8e8c6f256edb1836b9449cc7fe1 when a QObjectWrapper is deleted it resets the shared QQmlData propertyCache. In most cases the propertyCache except when a property updated in an existing binding in the first engine, where it currently asserts. Task-number: QTBUG-61681 Change-Id: I6efdc506e5c7e30b95cda1be282afa9feb781cd2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add support for QEvent::LanguageChangeSimon Hausmann2017-07-141-1/+45
|/ | | | | | | | | | | | | | | | | | | Respond to the language change event by refreshing all binding expressions. For constant string translation bindings we must now create special QQmlBinding instances instead of a one-time property write meta-call upon instantiation. Those however are more lightweight than an entire JavaScript expression. In addition this provides a slot to explicitly trigger a re-evaluation of bindings, to make it a little easier to discover for the developer. [ChangeLog][QtQml][QQmlEngine] Added retranslate() slot and QEvent::LanguageChange support to refresh bindings when changing the language at run-time. Task-number: QTBUG-15602 Change-Id: Ide174648e1d8a5738acb88e15495018d0869d7bc Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-251-1/+1
|\ | | | | | | | | | | | | Conflicts: tools/qmlimportscanner/main.cpp Change-Id: I01e17581f6691a03f83788773364d0cf96319514
| * QmlProfiler: Don't create a new event ID for each binding instanceUlf Hermann2016-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | We want the IDs to reflect the location and the type of event that is happening. Thus all instances of a particular component should share the same IDs for their bindings. Otherwise the aggregated views of the QML profiler list the same locations again and again for each object. Change-Id: I3f8a7531589b42f785e40c7c5b04b229f639d696 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-141-54/+19
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp src/qml/qml/qqmlimport.cpp src/quick/items/context2d/qquickcontext2dtexture_p.h tools/qmleasing/splineeditor.h Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
| * Avoid passing a FunctionObject to QQmlBinding::create()Lars Knoll2016-12-091-16/+3
| | | | | | | | | | | | | | | | Like this we can remove the QQmlBinding::create() overload that takes a FunctionObject. Change-Id: Ib6c37395ded325e68cf0fbf3afd08fb6dd6efa3b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Get rid of FunctionObject::createQmlFunctionLars Knoll2016-12-091-2/+2
| | | | | | | | | | | | | | | | Instead, simply create a QmlContext, and setup the bindings with the QV4::Function itself. Change-Id: I9db93b15112e43a6d5e275d126fb20f9c8833e8f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Avoid the creation of a FunctionObject for most bindingsLars Knoll2016-12-091-0/+15
| | | | | | | | | | Change-Id: Ia62d380945250015009d9c2b6ed65f6d830277ef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Limit access to m_function to QQmlJavaScriptExpressionLars Knoll2016-12-091-2/+4
| | | | | | | | | | Change-Id: I070f73f106440667fce2c7fe33310369a6aa1376 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Change signature of QQmlBinding::create to take a FunctionObject *Lars Knoll2016-12-091-2/+2
| | | | | | | | | | | | | | This is what's in the Value in all cases anyway. Change-Id: I212c4c4076050e8d0ea4cf6f72a1683e132cd51b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Mostly use the QV4::Function in javascript expressionsLars Knoll2016-12-091-14/+6
| | | | | | | | | | | | | | | | | | Move the function() accessor from QQmlBoundSIgnal to QQmlJavaScriptExpression. Change the profiler to operate on QV4::Function objects for binding profiling. Change-Id: Ic7ce83c487ceb69cad4b16e3dab42026238b7e82 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Remove unused argumentLars Knoll2016-12-091-6/+3
| | | | | | | | | | Change-Id: Ie490f113b6fc48ea75eb5903a79dddb02faa7301 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Add sourceLocation() accessor to QQmlJavascriptExpressionLars Knoll2016-12-091-1/+2
| | | | | | | | | | | | | | | | And remove it from the derived QQmlBoundSignalExpression class. Change-Id: I93cdc67136ddd916474acd2169faf380e296a900 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Merge remote-tracking branch 'origin/5.8.0' into 5.8Lars Knoll2016-12-071-2/+1
| |\ | | | | | | | | | Change-Id: I19804e880005c66880eeabfaebf0b1093de80e6b
| | * Don't read members of the binding after it has been freedLars Knoll2016-12-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a use after free valgrind error (and thus a potential crash) in tst_qqmljavascript::selfDeletingBinding that got introduced with change e7f28bd13b18cfcb36ef41804029b9b296117002 Change-Id: Ia6b69af199c0f2af1cc0d33d4f13a8593b2c6d51 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Cleanup and reduce the number of overloads for QQmlBinding::create()Lars Knoll2016-12-061-28/+1
| | | | | | | | | | | | | | | Change-Id: Ibcd277bc434638e5c6e8e9ccea634aa25cde1643 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Start cleaning up the QmlContextWrapperLars Knoll2016-12-041-1/+0
| |/ | | | | | | | | | | | | | | | | The class should get merged with the QV4::QmlContext class. Simplify the cleanup by moving both classes into a common file. Change-Id: I0074da79701d5f41eb51681b70fcde85bfd45fc1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-181-1/+1
|\| | | | | | | | | | | | | | | | | | | 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
| * QML: Move the ScarceResourceData from VariantObject onto the heapErik Verbruggen2016-10-051-1/+1
| | | | | | | | | | | | | | So now VariantObject is nearly a trivial struct. Change-Id: Ifc54c04d9686c03e12066c5287823dd3b1315d2a Reviewed-by: Simon Hausmann <simon.hausmann@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: treat permanent guards more like active guardsv5.8.0-alpha1Erik Verbruggen2016-08-311-0/+2
| | | | | | | Esp. when disabling notifications and marking notifiers as "done". Change-Id: I2d1c3bf048b32f68680744250e4250c3c4d76660 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Obliterate QQmlAccessorsErik Verbruggen2016-08-301-1/+0
| | | | | Change-Id: I70a080feb401cf23aef1bde44a19a11e27642f30 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Minor binding code cleanupSimon Hausmann2016-08-181-5/+6
| | | | | | | | Remove the QQmlBinding *binding argument as it is always the this pointer. Change-Id: I76ccf64a1d37ce32089c81f60466dce79b9fa5bf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QML: Make all fields in QQmlPropertyRawData privateErik Verbruggen2016-08-101-15/+15
| | | | | | | | 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-8/+6
| | | | | | | | | | 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: Split off value type information from property dataErik Verbruggen2016-08-091-56/+61
| | | | | Change-Id: I2ae2fb0f18af9b866cc9482fd4f42d9d4269f8cb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QJSValue: Adapt to introduction of QMetaType::NullptrChristian Kandeler2016-08-081-4/+5
| | | | | | | | | [ChangeLog][QtQml][Important Behavior Changes] A JS null value converted to a QVariant now has type QMetaType::Nullptr rather than QMetaType::VoidStar. Change-Id: I91a64e444ada0f1884fe807f9973348ba1a878ff Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Change the property data flags into a bit fieldErik Verbruggen2016-08-051-2/+2
| | | | | | | | | 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-23/+8
| | | | | | | | 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>
* QML: Add specialized binding for QObject* propertiesErik Verbruggen2016-08-021-16/+80
| | | | | | | | In it we can cache the meta-type for the specific QObject subclass of the property type. This reduces the number of calls to QMetaType. Change-Id: Ie3774395c971bc33af58a8290453b19631939ea8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Unify property reads/writes and use accessorsErik Verbruggen2016-07-251-15/+11
| | | | | | | | | 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>
* QML: Fix check when to use accessorsErik Verbruggen2016-07-191-3/+3
| | | | | | | | | | The bit indicating if accessors could be used only returned true when an interceptor was added to the object, but the property in question was not intercepted. So it missed the case where no interceptor was installed on any property of the object. Change-Id: I355eb7bbe232f512d02c1b9783a0e6f990552689 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Introduce write accessors to QQmlAccessorsErik Verbruggen2016-07-081-104/+57
| | | | | | | | | | | | | | | | Same idea as the read accessors, but with a slight difference: the property setters do emit signals, so we can't do a direct property write and have to call the setter. However, it does circumvent the meta-calls. There is one gotcha: if a property is intercepted (e.g. by a Behavior), we still have to do the meta-call in order to dispatch the write to the interceptor. According to valgrind, this saves 138 instructions on x86 for every "accessible" property write. Change-Id: I07dbac95613415559ffa1691734a5af7c84721fc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Specialize bindings based on target property type.Erik Verbruggen2016-06-271-77/+214
| | | | | | | | | | | When we can determine the type of a target property during type compilation, we can skip a whole bunch of code that deals with converting the result of a binding to the correct (target) type. This removes 65 instructions on x86 for such typed bindings. Change-Id: Id2c7c57b9ae6dfbeb921121beae9630604ca1d17 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* V4: Pass scope around as parameters inside the runtime.Erik Verbruggen2016-06-221-4/+6
| | | | | | | | | | | | | | | | The implementation of many (or all) runtime functions consist of first creating a QV4::Scope, which saves and restores the JS stack pointer. It also prevents tail-calls because of that restoring behavior. In many cases it suffices to do that at the entry-point of the runtime. The return value of a JS function call is now also stored in the scope. Previously, all return values were stored in a ScopedValue, got loaded on return, and immediately stored in another ScopedValue in the caller. This resulted in a lot of stores, where now there is only one store needed, and no extra ScopedValue for every function. Change-Id: I13d80fc0ce72c5702ef1536d41d12f710c5914fa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove QQmlCompiledData in favor of QV4::CompiledData::CompilationUnitSimon Hausmann2016-06-011-1/+0
| | | | | | | | | QQmlCompiledData used to contain the binary data for instantiating QML types in the QML VME. Nowadays the QML type compiler as well as the JavaScript compiler create a QV4::CompiledData::CompilationUnit. Change-Id: I155f62a5ecfb55a3fe230520231b6d8fd5b28ac9 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* QmlProfiler: Reduce memory usage for file names and URLsUlf Hermann2016-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | As the various file names are actually not kept as QStrings in the respective objects being profiled, our saving them as QStrings in each and every profiling event is not implicitly shared and causes a huge memory overhead. Avoid that by saving each location only once, indexed by a disguised pointer to the object it refers to. Normally, objects could disappear during the profiling session, and new objects could be allocated in their place, which would mess up our indexing system. We prevent that by referencing the objects when we index them, thus preventing them from getting auto-destructed. Mind that those are not JavaScript objects but rather functions, bindings, components and the like. So, this will only cause a memory leak if you're compiling and dropping QML components over and over. Task-number: QTBUG-52937 Change-Id: Ia4dfb09a71a5c9a2d6ce25c3811bbe2a1036c1c1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* QML: add some hot-path hints for the compiler.Erik Verbruggen2016-04-051-5/+5
| | | | | Change-Id: Ic68691639e81a8450311c03e86bcde14e7bd7dd4 Reviewed-by: Lars Knoll <lars.knoll@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>
* Move createQmlCallableForFunction out of the binding wrapperLars Knoll2015-09-081-1/+1
| | | | | | | | | It's now QV4::FunctionObject::createQmlFunction, which I believe is a better place and name for the method, esp. as it has no real connnection to the binding wrapper anymore. Change-Id: I59e20e120db72e53735b3a986e0b91bc7c3347d7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-181-1/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Remove superfluous checkFrank Meerkoetter2015-07-311-5/+0
| | | | | | | | | | | | | | | | The same check is done ~3 lines above. Change-Id: I8e6aeff89a7b0f3805afdf453b133dc98da59066 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Smaller cleanup to QQmlJavaScriptExpressionLars Knoll2015-06-181-7/+4
| | | | | | | | | | | | | | Clean up some of the code to create binding expressions. Change-Id: I1cd826685713b44166c58b114fa91135a664591d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Remove a global read-write QQmlBinding::Invalid variableLars Knoll2015-06-101-2/+0
| | | | | | | | | | Change-Id: I3ca148ae021ffc349b943231cc749828b0b7816c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Save one more pointer on each bindingLars Knoll2015-06-101-1/+1
| | | | | | | | | | | | | | | | Fold the isAddedToObject flag into the nextBinding pointer. Reorder the members to avoid holes in the data. Change-Id: I0a216940f52020a5d48a6ed05cc236c248161b08 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Make bindings refcountedLars Knoll2015-06-101-1/+7
| | | | | | | | | | | | | | | | | | | | | | Refcounting our bindings greatly simplifies our memory management of the objects and ensures we safely clean them all up. In addition, it allows us to remove the m_mePtr and weak reference handling from QQmlAbstractBinding as we can safely handle this through the same mechanism. Change-Id: If23ebc8be276096146952b0008b62018f5d57faf Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Replace bindingType() method by a virtual getterLars Knoll2015-06-051-5/+5
| | | | | | | | | | | | | | | | | | This removes the need to save some bits in the abstract binding object, and should make it easier to move QQmlAbstractBinding over to be reference counted. Change-Id: Ib46cb3217f3dc462f1dcaa6153d90ea2f7401f48 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move the writeBinding method into QQmlBindingLars Knoll2015-06-051-4/+152
| | | | | | | | | | | | | | | | It's only called from there; this simplifies the code and will allow some further optimizations. Change-Id: I1f0befe620beaa0bbf961fc829881ef7b5c2e435 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Fix resolving of nested alias propertiesLars Knoll2015-06-051-2/+2
| | | | | | | | | | | | | | | | | | When looping to resolve nested aliases, make sure we use the correct property index to determine the vme meta object that contains the next level of alias data. Change-Id: Id2077b164a4591c86ccb63e8ed3bb997d719731c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>