aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetatype.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix don't delete singletons objects owned by C++BogDan Vatra2016-01-251-1/+1
| | | | | | | | | | Don't delete singletons objects that are created only from C++ and have explicitSetObjectOwnership flag set, explicitSetObjectOwnership flag is set only by QQmlEngine::setObjectOwnership. Task-number: QTBUG-49865 Change-Id: I0ef658c2094e67b5cd9a1585e273144dfcee736a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Don't delete singletons objects owned by C++.BogDan Vatra2015-10-151-1/+6
| | | | | | | | | | This way we can enable the usage of a single singletons in both worlds. Currently singletons are destructed before the other QML types, and using a singleton that is owned by C++ we don't need to care about the destruction order anymore. Change-Id: I120fcb8659e16321ae6e70c7b0d62be3bc650d73 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make QML composite types inherit attached propertiesJ-P Nurmi2015-10-091-22/+40
| | | | | | | | Change-Id: Ic06af4805da987dd08e361f2668e7a1788d3eefe Task-number: QTBUG-43581 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Factor out method to get pretty QML type nameTobias Koenig2015-09-241-0/+39
| | | | | | | | | Factor out the code to get the pretty QML type name for an QObject from ~QQmlInfo and put it into QQmlMetaType::prettyTypeName() method. Change-Id: I54ab0c49ba4a52074877447ef67708104f954f2d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make QML composite types inherit enumsJ-P Nurmi2015-09-211-3/+27
| | | | | | | | | | | | | | | | | | | | | | | Problem: in Qt Quick Controls 2, enums declared in the abstract C++ base types were not accessible with the concrete QML type name, but had to be referenced using the base type name: Slider { snapMode: AbstractSlider.SnapOnRelease } Solution: this change resolves the C++ base type and creates the missing link between the composite type and its base type's meta- object. This allows referencing enums using the concrete/composite QML type name: Slider { snapMode: Slider.SnapOnRelease } Change-Id: Icefdec91b012b12728367fd54b4d16796233ee12 Task-number: QTBUG-43582 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Explicitly push/pop ExecutionContextsLars Knoll2015-09-151-6/+2
| | | | | | | | Avoid the implicit push inside the execution context constructor and rather make this explicit in the code. Change-Id: I1bb0fb523fddbb273fc666370d619f55f49cd40a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-181-1/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * add null check for qmlRegisterSingletonType()Tasuku Suzuki2015-07-241-0/+3
| | | | | | | | | | | | | | | | | | | | When the callback passed to the function returns nullptr, QQmlData::ensurePropertyCache(e, o) crashes. Change-Id: I11efd7e9d6c5f18611e796d896384dd14a280303 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Christopher Adams <chris.adams@jollamobile.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * 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>
* | qml: Pass non-trivially-copyable types by const-refSérgio Martins2015-07-201-1/+1
| | | | | | | | | | Change-Id: Id3d960ee8236a4c6f4bb4e0add1f88dfa32d3592 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Don't try to load (or unload) QML plugins if QT_NO_LIBRARYUlf Hermann2015-06-191-0/+2
| | | | | | | | | | | | | | | | Most of the code already has those #ifdefs, so let's add the missing ones. Change-Id: I2a46d5ab660daa837d9ce432184d0b55818a5dc1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Add 28 QList::reserve() callsSérgio Martins2015-06-081-0/+1
| | | | | | | | | | Change-Id: Id4820ac458f48b10f2bf457144767efdef9e2c07 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Fix build with QT_STRICT_ITERATORSSérgio Martins2015-05-151-6/+6
|/ | | | | Change-Id: I3df6ac107cb46b3a1b15b80f39d7c6015adcd9ac Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Changed QML type lockingSimon Hausmann2015-04-161-44/+44
| | | | | | | | | | Replace the use of QReadWriteLock with a plain QMutex. At this point QReadWriteLock adds a lot of overhead due to its internal QHash and otherwise offers little over a recursive mutex, especially given that there is most of the time only one reading thread and one writing thread. Change-Id: I0a91e4a64cff5d25e4a133ed46b08912e81bb055 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QtQml: Micro-optimize iterator loops.Friedemann Kleint2015-02-261-4/+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>
* Allow importing protected modules with different major versionsJ-P Nurmi2015-01-081-2/+2
| | | | | | | | This allows QtQuick.Controls 1.x and 2.x imports to co-exist even if they are two different plugins with the same module directive. Change-Id: Idee302439e3c2fd6813ba2f41b69144fbae7902c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Allow multiple cached qml unit registration functionsSimon Hausmann2014-09-241-5/+7
| | | | | | | | Only few will be necessary, but this allows for greater flexibility at run-time. Change-Id: Ia03abeb6296a5dee97544209c578dc2974af7cbc 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>
* Accelerate property lookups for C++-based QObject singletons.Michael Brasser2014-08-071-1/+4
| | | | | Change-Id: Icbdf06a077014db5dd57cba42f84591433ec4196 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove dead codeSimon Hausmann2014-03-291-22/+0
| | | | | | | | | Remove qquick anchor line comparison hooks, which were intended to be used inside the old v4 interpreter (but that was incomplete) and are now completely unused. Change-Id: I06b0dd684a292adb44efa52d27258242954285ee Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make it possible to supply compilation units from pluginsSimon Hausmann2014-03-291-0/+22
| | | | | | | | | This also cleans up the script and type initialization in the type loader, for example by getting rid of the m_irUnit member for scripts. Change-Id: I207afeb21c0bae9091d3c7b4cac2e80e9aae0ea3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-241-0/+11
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/dialogs/qquickmessagedialog.cpp src/imports/dialogs/qquickmessagedialog_p.h src/qml/debugger/qqmlprofilerservice_p.h src/qml/jsruntime/qv4regexpobject.cpp tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro Change-Id: Ic8a43366b44d6970966acbf03b206d0dee00c28d
| * Fix compile error with clang 3.4Lars Knoll2014-01-231-1/+1
| | | | | | | | | | Change-Id: Iaf43f0527142bb5615e8c97bb1a80faf7b8b2e00 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * qmplugindump is not able to dump all registered componentsDaniel Pesch2014-01-211-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | This patch implements a new function QQmlMetaType::qmlAllTypes() used by qmlplugindump that returns list of all registered components. Previous implementation used QQmlMetaType::qmlATypes() call that returned only components with defined QML name. Task-number: QTBUG-36199 Change-Id: I85acba61cfa511973a004934cf0650f38cc46ed9 Signed-off-by: Daniel Pesch <dpesch@blackberry.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* | fix whitespaceOswald Buddenhagen2014-01-221-10/+10
| | | | | | | | | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | QQmlMetaType: adapt to upcoming MOC format changeMarc Mutz2013-12-041-1/+1
|/ | | | | | | | | | | A change is pending on qtbase that turns relatedMetaObjects into a const pointer-to-const in order to make the relocation a read-only one. Adapt. Change-Id: I503eca13c1fe80d070e3078620fa3fd5ecdef0b0 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Initial support for accelerated property access to QML singletons and enumsSimon Hausmann2013-11-251-2/+6
| | | | | | | | | With this patch we determine the meta-object of singletons, propagate it into the IR and load them separately using a dedicated run-time function. In addition enums in singletons and QML types are resolved at compile time. Change-Id: I01ce1288391b476d1c9af669cb2987a44c885703 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add Singleton support for QMLAntti Piira2013-09-211-10/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces Singleton support for QML (Composite Singleton). For now, the Singleton support is only availabe for QML types in modules or (remote and local) directories with qmldir file. However, in the future this support may be expanded to arbitrary QML file imports without by leaving out the qmldir requirement. You define a QML type as a Singleton with the following two steps: 1. By adding a pragma Singleton to a type's QML file: pragma Singleton The pragma and import statements can be mixed and their order does not matter. Singleton is the only supported pragma for now. Others will generate errors. 2. By specifying a qmldir file for the directory of your imported type and prepending the type with "singleton" keyword as follows: singleton TestTypeSingleton TestTypeSingleton.qml Alternatively you may specify a qmldir file for a module and specify your type as a singleton as follows: singleton TestTypeSingleton 1.0 TestTypeSingleton.qml Composite Singletons may be included in a module and may be used with a local namespace qualifier when imported with: "import xxx as NameSpace" A singleton instance is created at first use and stored into the QmlEngine (one instance per engine) and eventually released by the engine's destructor. CompositeSingletonType has a dual nature and will return true to both isComposite() and isSingleton() calls. In most cases its enough to check for just isComposite() or isSingleton(). However, there is a isCompositeSingleton() available as well. I used "qlalr --no-debug --no-lines --qt qqmljs.g" to generate the qqmljsparser and qqmljsgrammar files from qqmljs.g. Unit tests are included. Change-Id: I91b303612c5e132143b325b9a8f982e9355bc90e Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* Add qmlProtectModuleAlan Alpert2013-09-201-5/+53
| | | | | | | | | A C++ analog to the protected qmldir syntax, this is also a potential performance improvement because we can avoid some file system accesses. Change-Id: I41781a6cc72aa65bd2d397800345ea16ef442e90 Reviewed-by: Antti Piira <apiira@blackberry.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of the first half of QQmlGuard usageLars Knoll2013-07-051-1/+0
| | | | | | | | | QQmlGuard was being used as a more performant replacement for QPointer. QPointer got now fixed in Qt 5.0, making this class obsolete. Change-Id: I77eef066c4823af4b074ef32d4d78dbd67c36cd0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of QHashedV4StringLars Knoll2013-06-281-3/+3
| | | | | | | | 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>
* Remove a potentially dangerous optimisationLars Knoll2013-06-281-25/+4
| | | | | | | | The code could fail in case the hashing would happen to return the same value for both strings. Change-Id: I7c256754b38aafd8c49b9fbbd2f01b9cc0346a2b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into ↵Simon Hausmann2013-06-241-10/+36
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Add qmlClearRegisteredTypes FunctionAlan Alpert2013-05-071-0/+24
| | | | | | | | | | | | | | | | | | | | | | Registered types are stored in a global static variable, not on an engine instance. For applications managing multiple engines over their lifetime, there needs to be a way to clear the existing types so they can register new ones and avoid memory leaks. Task-Number: QTBUG-28572 Change-Id: Ic70a4dd1e29d99399b21fb42eaf10d4a52bf2adf Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
| * Avoid rare crashAlan Alpert2013-05-041-10/+12
| | | | | | | | | | | | | | | | | | In the case where a QML type had been registered with the same metaobject, you could dereference the c++ type union data when it hadn't been allocated. Change-Id: I906d68710cf88b379933eb13cf0668738f07d5f4 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
* | Fix failing assertion in tst_qqmlecmascript::singletonTypeSimon Hausmann2013-05-231-0/+3
| | | | | | | | | | | | | | | | Don't try to call the singleton callback with the current scope but instead execute it well-defined within the scope of the global context. Change-Id: I6b59fad7d466a6070d1c748f909e1d8c0a1045ea Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Remove v8 dependencies in qhashedstringLars Knoll2013-05-221-3/+3
|/ | | | | | | Also remove now unused API in v8::String Change-Id: I2570aedf407c89ad85da01cf0e2153a52b4e562d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add Composite Types to QQmlTypeAlan Alpert2013-02-181-51/+139
| | | | | | | | | When a composite type is loaded from a QML file, it now generates a QQmlType entry in QQmlMetaTypeData. Change-Id: I9b127dff7955456aacb25138fa6ea8efb7bb9221 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com> Reviewed-by: Alan Alpert <aalpert@rim.com>
* Use constFind instead of find in QQmlMetaType::qmlTypehjk2013-02-061-2/+2
| | | | | | | | There is no need to detach when only checking for the presence of an item. Change-Id: I59a0aadb74b4613b019882bcf67e84e68df18a21 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Refactor QQmlTypePrivateAlan Alpert2013-01-241-90/+166
| | | | | | | | Now has a registrationType, and an extraData union for data only relevant to certain registration types. Change-Id: I9b127dff7955456aacb25138fa6ea8efb7bb9220 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* Merge branch 'stable' into devGunnar Sletta2013-01-171-1/+1
|\ | | | | | | | | | | | | | | Conflicts: src/qml/doc/qtqml.qdocconf src/quick/doc/qtquick.qdocconf Change-Id: I087fa14720995a5e53c43567dc4a3c29eb9992a9
| * 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>
* | Remove m_ in property names of QQmlTypePrivateAlan Alpert2013-01-081-183/+183
|/ | | | | | | | There's already a d-> to indicate they are internal variables. Doesn't need both. Change-Id: I9b127dff7955456aacb25138fa6ea8efb7bb921f Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* Fixed memory leak of registered QML modulesVadim Zakondyrin2012-11-191-0/+4
| | | | | | Change-Id: I254f755641f5ac8383e5818b5294ec85fd9236e8 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Christopher Adams <chris.adams@jollamobile.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>
* Refactor singleton type registration codeChris Adams2012-08-281-153/+192
| | | | | | | | | | | Previously each singleton type was registered as an implicit separate import. This commit changes the code so that these types are treated just like any other type in the registration sense. It also ensures that singleton types are instantiated per-engine. Change-Id: I5c81c4ca5bf65210f7125d74a62a282a21838068 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Fix warnings in QtQmlMatthew Vogt2012-08-241-7/+9
| | | | | Change-Id: Ibba3b8e878257f7019bdc90a1344462b77f95a21 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Add type name to singleton (module api) implementations.Glenn Watson2012-08-081-37/+87
| | | | | | | | | | | | | This change renames the previous module api implementation to singleton types. When a singleton type is registered, a type name must be provided that is used when accessing the API from QML. This makes the implementation more consistent with the rest of QML. Task-number: QTBUG-26549 Change-Id: Iab0bb1ccf516bd3ae20aee562a64d22976e0aecd Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Implement strict mode for qmldir modulesMatthew Vogt2012-07-311-3/+71
| | | | | | | | | | | | | | | Allow a module's qmldir to contain a module directive, which when present specifies 'strict mode' import processing. In strict mode, type registrations are only permitted into the namespace identified in the qmldir file's module directive. In addition, any type registrations to that namespace originating from other modules are treated as error conditions. Task-number: QTBUG-26551 Change-Id: I081bde2d3b83d3f28524440177fb2cd1ccee34ad Reviewed-by: Chris Adams <christopher.adams@nokia.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>