aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlboundsignal_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Simplify signal handler parameter handlingSimon Hausmann2018-07-311-4/+2
| | | | | | | | | | | | | | | | | | | | | | Unify the two QQmlBoundSignalExpression constructors and always call updateInternalClass on the run-time function to set up the parameter name -> argument mapping. This streamlines the code, shares the error handling for unnamed parameter clashes and allows getting rid of the code to extend the formals of functions that become signal handlers in AOT generated cache files. Either onThatSignal: function(param1, param2) { ... } syntax is used and the mapping is fixed and known at AOT/compile time. Or alternatively the dynamic variant is used where the formals are determined at signal handler installation time. Saves a whopping KB of RAM on the QQC1 gallery. Change-Id: I33a9afc06474143d7893f42366cb6553a07ce937 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* use the override keyword consistently and correctly (clang-tidy)Shawn Rutledge2018-02-271-1/+1
| | | | | Change-Id: If9e28d143f8cba3df3c757476b4f2265e2eb8b2a Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-2/+2
| | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-141-4/+2
|\ | | | | | | | | | | | | | | | | | | | | | | 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
| * Pass a QV4::Function to the QQmlBoundSignalExpression constructorLars Knoll2016-12-091-1/+1
| | | | | | | | | | | | | | And avoid the creation of a temporary FunctionObject Change-Id: Idaacfd978ac4ee26960bdf185272cc44d6618a71 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Mostly use the QV4::Function in javascript expressionsLars Knoll2016-12-091-2/+1
| | | | | | | | | | | | | | | | | | 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>
| * Add sourceLocation() accessor to QQmlJavascriptExpressionLars Knoll2016-12-091-1/+0
| | | | | | | | | | | | | | | | And remove it from the derived QQmlBoundSignalExpression class. Change-Id: I93cdc67136ddd916474acd2169faf380e296a900 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: add missing 'override'Anton Kudryavtsev2016-10-061-2/+2
|/ | | | | | | ... and drop redundant 'virtual' Change-Id: I8c0d589557f590eb528e80414d9c002504ccb12a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Merge remote-tracking branch 'origin/5.6' into devSimon Hausmann2016-01-221-0/+1
|\ | | | | | | Change-Id: I4af0bf8ec1569097d97f8ce0bb8bf1a0e4a989ec
| * Provide access to signal parameters in SignalTransition::onTriggered.Michael Brasser2016-01-191-0/+1
| | | | | | | | | | | | | | Change-Id: Ib74d3f5e9a357a86b818e27dd7249e2ecdf1e513 Task-number: QTBUG-46897 Reviewed-by: Brett Stottlemyer <bstottle@ford.com> 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>
* | Add enabled property to the QML Connections elementDan Cape2015-09-091-0/+4
|/ | | | | | | | | | | | Now allows a quick way to enable/disable the signal handlers in the QML Connections element. Updated test file to have objectName and added test for this new functionality. Set to be available as of QtQml2.3. [ChangeLog][QML Elements] Allow enabling/disabling of connections established using a Connections element Change-Id: Ib0de2b3c78bb529ef74d5b4bb4ccb0f335cc50de Task-number: QTBUG-36350 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix some function signatures and remove an unused functionLars Knoll2015-06-181-2/+1
| | | | | | | | The returned value of these methods is never used, so save some cycles and return void. Change-Id: I7e2430130853af12de9685c4383197c80c151175 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* QQmlBoundSignal doesn't need a vtableLars Knoll2015-06-181-1/+1
| | | | | Change-Id: I229740b6cff12a7b43a9ec5ab5b1c5a216843547 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Save another pointer in QQmlBoundSignalLars Knoll2015-06-181-3/+0
| | | | | | | | | isEvaluating is not really needed as it's tightly coupled to the isNotifying flag in the parent class. Use that instead, to get rid of it. Change-Id: Ic7274ac54e4d380567522c8a549b98d5ed1a1798 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* No need to store the same data twiceLars Knoll2015-06-181-3/+0
| | | | | | | | Remove the index member from QQmlBoundSignal, as the NotifierEndpoint already stores the index. Change-Id: Idd8848ae1ca97b964ca1be0bab1c8aba540ace43 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of QQmlBoundSignalExpression::ExtraDataLars Knoll2015-06-181-22/+1
| | | | | | | | | | | | | The extra data was only used to delay initialization of the required FunctionObject to the first time evaluate got called. In addition, the constructor using ExtraData was only ever called from the debugger. In that case performance can't be critical, so we can just as well do function object creation at construction time. This saves one pointer in the object. Change-Id: I46ce9aa325f0fa95b5b0e374e9c07d673e454dd4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of QQmlAbstractBoundSignalLars Knoll2015-06-181-26/+11
| | | | | | | | QQmlBoundSignal is the only class inheriting from it, so we might as well get rid of the abstract base class. Change-Id: I1b59a5d30d9a6ff1111e54f47530687b47f39d70 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Move m_function into the base classLars Knoll2015-04-271-2/+0
| | | | | Change-Id: I2ebc0ac8f5085157f5d1ec71a1b75559c6a46f8b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Remove the manual vtable from QQmlJavaScriptExpressionLars Knoll2015-04-251-3/+3
| | | | | | | | Now that the class got unified with QQmlAbstractExpression, it has a vtable anyway, so we can just as well remove the old hack. Change-Id: Ifa095297e3d75564c4305ce3655eaa57436ef4a8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of QQmlAbstractExpressionLars Knoll2015-04-241-2/+1
| | | | | | | | | The class is always used together with QQmlJavaScriptExpression, so we can just as well fold the functionality together into one class and simplify our code. Change-Id: I23820e51efaaea16ae5db7e2153a827d7b22999e Reviewed-by: Simon Hausmann <simon.hausmann@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>
* Get rid of most uses of ValueRefLars Knoll2015-01-231-1/+1
| | | | | | | | | | | | Instead pass a const Value & into the functions With our new inheritance structure, we can get rid of ValueRef and instead simply pass a pointer to a Value again. Pointers to Values are safe to use again now, as they are now guaranteed to be in a place where the GC knows about them. Change-Id: I44c606fde764db3993b8128fd6fb781d3a298e53 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make sure we always have an engine when assigning to a PersistentLars Knoll2015-01-131-1/+1
| | | | | | | This prepares things for a rewrite of the internals of Persistent. Change-Id: Ib93ec5911984d1bfce87ffdc3f86bc75f6ecafe9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* QQmlBoundSignalExpression: Remove extra padding.Robin Burchell2014-09-151-1/+1
| | | | | | | Size goes from 104 to 96 bytes on x86_64. Change-Id: I84614d9e4949e4470e841c0efb6a674e1cb74778 Reviewed-by: Simon Hausmann <simon.hausmann@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>
* Avoid recompiling of signal handlers defined in QtQuick state changes and ↵Simon Hausmann2014-04-021-0/+2
| | | | | | | | | | Connection objects We can re-use the expression we've compiled at QML type compilation time, as long as we "inject" the signal parameters in the dynamic qml lookup chain. Change-Id: Icc417531c41dea06ff5d033011179af49b03f542 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Save another 4/8 bytes per QQmlBoundSignalExpressionSimon Hausmann2014-03-271-1/+1
| | | | | | | | We can move the persistent to hold the scope for a string compiled binding into the extra data. Change-Id: I033aa6d080402a1eb19cdae540f9af2c5c3a3fc7 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Combine the source file, line and column number triplet in a common structureSimon Hausmann2014-03-041-6/+2
| | | | | | | | | This avoids unnecessary function calls when all of the three pieces need to be retrieved from a QQmlBoundSignalExpression. Change-Id: Ibcd498c907ea723baf6439cf32ca5fc704f204b5 Reviewed-by: Ulf Hermann <ulf.hermann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Reduce size of QQmlBoundSignalExpression in the common case.Michael Brasser2014-03-041-14/+26
| | | | | | | | | | This reduces the base size of QQmlBoundSignalExpression by 20 bytes, by moving member variables specific to runtime rewrites in to an "extra" structure. Task-number: QTBUG-37134 Change-Id: I235895a395ba4304a7ea071d88aa9aebcfff61cb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Retrieve detailed location information when profiling signal handlersUlf Hermann2014-01-211-0/+1
| | | | | | | | | Use the Functions associated with signal handlers to find out which exact code is being executed. Task-number: QTCREATORBUG-11100 Change-Id: Idfae9d188b17977b55f551e6fe766042fe24e786 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix Persistent/WeakValue APILars Knoll2013-09-261-1/+1
| | | | | | | Don't use unprotected Values in the API anymore. Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* [new compiler] Initial implementation of signal handler supportSimon Hausmann2013-09-201-0/+3
| | | | | | | | | | Signal handlers start out in the parser as binding expressions. A new SignalHandlerConverter converts the bindings then so that the expression is turned into a function declaration where the function parameters match the parameters of the signal. Change-Id: I3ea5aa3b80a6ee3b095c6841c63c3e3bb0b47e4f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix regression in tst_qqmlecmascript::signalAssignmentSimon Hausmann2013-07-051-1/+3
| | | | | | | | | | 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-13/+5
| | | | | | | | | | | | | 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>
* Change some v8::Persistent to QV4::PersistentValueLars Knoll2013-05-071-2/+2
| | | | | Change-Id: I2c4e98cf7e778de9aafabdbd68e6682106343d12 Reviewed-by: Simon Hausmann <simon.hausmann@digia.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>
* 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>
* Avoid dynamic lookup of signal handler argumentsMichael Brasser2012-08-241-20/+21
| | | | | | | | | | | 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>
* Reduce memory consumption of source coordinatesMatthew Vogt2012-08-161-6/+7
| | | | | | | | | | Reduce memory consumption by storing source location coordinates as 16-bit variables (in run-time structures). Also modify qmlmin to restrict line lengths so that the column bound is not normally exceeded. Change-Id: I08605626ffbdf081b6da2aea1116bdfe24998572 Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
* Reduce size of QQmlNotifierEndpointAaron Kennedy2012-05-241-2/+2
| | | | | Change-Id: I4d4a22f5f3d88d4ad2fcd738753fd8da2d8a9263 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Lazily create QMetaObjectsAaron Kennedy2012-05-241-1/+1
| | | | | | | | | | 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>
* Detect and abort if an object is deleted during signal handlingKent Hansen2012-05-211-0/+1
| | | | | | | | | | | | | | | | | | | | If an object gets deleted while one of its own signal handler expressions is being evaluated, a subsequent crash is inevitable. While we could introduce guards/checks in the signal handler kernel (QMetaObject::activate(), QQmlNotifier::emitNotify() and friends) to detect and mask the sender deletion, this arguably isn't helpful; the code that emitted the signal is likely to access member variables directly after emitting the signal, causing semi-random crashes. This situation is a symptom of misbehaving application code. Catch it early rather than later, and issue a qFatal() with a helpful message. Coupled with a backtrace, this should make it easier to track down the flawed C++ application logic. Change-Id: I8c77800e49c475def613224f208181c2d0af60e6 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Improve memory usage of Connections and signal handlers.Michael Brasser2012-05-181-3/+7
| | | | | | | | Following the pattern of 330152354aed8496ac78d145e14b25ee2d7bf8fb, store the source as Utf8. Keep one less copy of the source when possible. Change-Id: Ifa5f5fdc9ea3d48e904489dc262145eff36e710c Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Remove unnecessary exportsMatthew Vogt2012-05-181-3/+3
| | | | | | | | | Reduce library load time by removing any exports which are not required by existing clients. Task-number: QTBUG-24768 Change-Id: Ia5754d6f97bb2ed46e290820a5b092f85a4bc5b0 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Permit signals to be emitted in a different threadAaron Kennedy2012-05-111-1/+1
| | | | | | | | | | | | The QQmlNotifier approach to connecting to signals did not support the cross-thread signal/slot model used elsewhere in Qt. This change allows one specific case of that - emitting a signal in a different thread than the one the QObject lives - to work. Task-number: QTBUG-25647 Change-Id: Ia8fdaf4c7d7e2ccd7ff7657bb1d8e26277eb60aa Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* More robust tracking of signal handler expression ownership.Michael Brasser2012-05-011-5/+10
| | | | | | | Reference count the expressions, and improve testing. Change-Id: I810509eae1c7608b367e9ff5f7891a294667a692 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Optimise memory usage of bound signalsChris Adams2012-04-261-5/+11
| | | | | | | We can save a few bytes per bound signal by using a flag pointer. Change-Id: I96d23dc287722e549e21e4c5d978bed0ba2f4bed Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Support and use parameters in QQmlNotifierEndpoint.Michael Brasser2012-04-231-6/+8
| | | | | | | | | Allow QQmlNotifierEndpoint to support signals with parameters. Update QQmlBoundSignal to use this support. Change-Id: Ie2a245b39283b0b66d66bd2350e8bc85fe519bb5 Reviewed-by: Chris Adams <christopher.adams@nokia.com>