aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlincubator_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Encapsulate QQmlContextDataUlf Hermann2020-03-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class is not a private detail of QQmlContext. And it is incredibly hard to see who owns what in there. Let's add some civilization ... We enforce refcounting for QQmlContextData across the code base, with two exceptions: 1. QQmlContextPrivate may or may not own its QQmlContextData. 2. We may request a QQmlContextData owned by its parent QQmlContextData. For these two cases we keep flags in QQmlContextData and when the respective field (m_parent or m_publicContext) is reset, we release() once. Furthermore, QQmlContextData and QQmlGuardedContextData are moved to their own files, in order to de-spaghettify qqmlcontext_p.h and qqmlcontext.cpp. When the QQmlEngine is deleted, any QQmlComponents drop their object creators now, in order to release any context data held by those. Before, the context data would be deleted, but the object creators would retain the dangling pointer. [ChangeLog][QML][Important Behavior Changes] QQmlContext::baseUrl() does what the documentation says now: It prefers explicitly set baseUrls over compilation unit URLs. Only if no baseUrl is set, the CU's URL is returned. It used to prefer the CU's URL. Change-Id: Ieeb5dcb07b45d891526191321386d5443b8f5738 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Required properties: Allow retroactive require specificationFabian Kosmale2020-01-311-3/+1
| | | | | | | | It is now possible to mark a property of a parent class as required in the child by writing required <propertyName> Change-Id: I9e9d58c7b5c00577b056e905b39744b2fa359ea0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Support required properties in model delegatesFabian Kosmale2019-09-121-0/+1
| | | | | | | | | | | | | | | If a delegates declares a required property of a given name, and that name exists as a role in the model, we set the property accordingly. The same holds true for the special properties that come from the QQmlDelegateModel like "index" and "model". All roles are still injected into scope and thus accessible; changing this in Qt5 would be tedious or even impossible while still maintaining backwardscompatibility with delegates that do not use required properties. Change-Id: I4f388ba549c42f1ff9822bdb3b8357c4d45e4b66 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Introduce required properties to QMLFabian Kosmale2019-09-091-1/+7
| | | | | | | | | | | | | | | | | | | [ChangeLog][QtQml] "required" is now a (contextual) keyword in QML, and users can mark properties with it to specify that those properties must be set when the component gets instantiated. This can be done either declaratively via standard property bindings from QML, or imperatively by using the functions to set initial properties (QQmlCompoent::setInitalProperties and related functions in C++, Qt.createObject, Loader.setSource,... in QML/JS). Logic has been added to QQmlComponent::create and the various QQmlIncubator classes to verify that the required properties were set. If properties marked as required are not set, a warning will be printed at runtime, and the component will not be created. Change-Id: I8e38227fc8f173b053b689c1597dc7fd40e835e7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Split CompiledData::CompilationUnit in twoUlf Hermann2019-05-161-1/+1
| | | | | | | | We need a CompilationUnit that only holds the data needed for compilation and another one that is executable by the runtime. Change-Id: I704d859ba028576a18460f5e3a59f210f64535d3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Revert "Allow canceling incubation"J-P Nurmi2018-01-171-3/+0
| | | | | | | | | | | This reverts commit ca6b787a01ea289bd5c2a3e4ff3c7442a4ff58fc. This internal API was added as a workaround for Qt Quick Controls 2. It is no longer needed now that Qt Quick Controls 2 are using deferred execution. Task-number: QTBUG-50992 Change-Id: Iaddf22460f091743e1a68acd16813a28f3e82ecb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Allow canceling incubationJ-P Nurmi2017-01-241-0/+5
| | | | | | | | | | | | Qt Quick Controls must avoid destroying any object that belongs to a tree of objects being incubated. The problem is that QQC have no control over the incubation process. This patch adds private API that allows QQC to cancel incubation of a specific item that QQC would like to destroy. Change-Id: Id9f9004736e2b53fe46cdb6bb3055b7457def94d Task-number: QTBUG-50992 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use automatic refcounting for the compilation unit in QQmlComponentPrivate ↵Simon Hausmann2016-06-031-1/+1
| | | | | | | and the incubator Change-Id: I70d609ce282a537b67a5e7c01c12d9ce65995133 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove QQmlCompiledData in favor of QV4::CompiledData::CompilationUnitSimon Hausmann2016-06-011-2/+1
| | | | | | | | | 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>
* Remove "external" usages of QQmlCompiledData::engineSimon Hausmann2016-06-011-0/+1
| | | | | | | This removes the last "user" of QQmlCompiledData apart from its circular usage. Change-Id: I5383c9e7bba03617a1145cd43f52051848962013 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>
* 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>
* 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>
* Remove old compiler and VMESimon Hausmann2014-03-071-4/+0
| | | | | | | | | | | | This removes the bulk of the code. A few smaller cleanups remain, to be done in smaller changes as they move code around. Additionally the "optimize" option of qqmlbundle was removed. It called QQmlScript::Parser::preparseData, which however was not implemented and always returned an empty QByteArray. Therefore "optimize" would not do anything and the class is gone now :) Change-Id: I0c265e756704cb53c5250be1f69e4a3e1b6e64d5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Match class and file nameSimon Hausmann2014-02-161-1/+1
| | | | | | | QmlObjectCreator -> QQmlObjectCreator Change-Id: I23da2d9c7fa0dcd760f5cc695c1759b44d1e72f0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Allow for interruption during object finalizationSimon Hausmann2014-02-071-2/+2
| | | | | | | | | The object tree construction and binding allocation remains synchronous, but the initial evaluation of the bindings is now cooperatively interruptible again, like in the VME. Change-Id: Idd037dd481782c81ad43e20e93d922eb12ac8b85 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Preliminary support for QQmlIncubatorSimon Hausmann2014-01-081-0/+5
| | | | | | | | Just enough to run some unit tests that use QQuickLoader, components are created instantly. Change-Id: I1c827aa946d3e2a60ccc220bb79572aca2ed8c96 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix infinite loop in QQmlIncubator::forceCompletionAlbert Astals Cid2013-10-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this change I'm getting this backtrace 3 0x4025b9f2 in QQmlIncubatorPrivate::incubate (this=0x18daa78, i=...) at qml/qqmlincubator.cpp:273 4 0x4025c1c2 in QQmlIncubator::forceCompletion (this=0x1527360) at qml/qqmlincubator.cpp:592 5 0x404e1626 in QQuickVisualDataModelPrivate::object (this=this@entry=0x13909f8, group=QQuickListCompositor::Default, index=index@entry=1, asynchronous=asynchronous@entry=false) at items/qquickvisualdatamodel.cpp:900 6 0x404e1f7e in QQuickVisualDataModel::item (this=<optimized out>, index=1, asynchronous=<optimized out>) at items/qquickvisualdatamodel.cpp:968 Note: This is with patched 5.0.x, change QQuickVisualDataModel to QQmlDelegateModel for >= 5.1 and line numbers may be a bit off What is happening: QQmlIncubator::forceCompletion is doing while (Loading == status()) { while (Loading == status() && !d->waitingFor.isEmpty()) static_cast<QQmlIncubatorPrivate *>(d->waitingFor.first())->incubate(i); if (Loading == status()) d->incubate(i); } Calling QQmlIncubatorPrivate::incubate on the first item of d->waitingFor Then, that item is getting to QQmlIncubatorPrivate::incubate and happens that progress is QQmlIncubatorPrivate::Completed and waitingFor is not empty, so the only thing that QQmlIncubatorPrivate::incubate ends up doing is calling a few calls over vmeGuard and returning, that way the inner waitingFor items never finishe incubating and you end up in an inifite loop inside while (Loading == status() && !d->waitingFor.isEmpty()) static_cast<QQmlIncubatorPrivate *>(d->waitingFor.first())->incubate(i); This patch basically replaces this loop with a loop that does while (QQmlIncubator::Loading == status && !waitingFor.isEmpty()) static_cast<QQmlIncubatorPrivate *>(waitingFor.first())->forceCompletion(i); This way we make sure we incubate the waitingFor items of our waitingFor items Change-Id: I4298efc7ba9d8af624bb138e64b92a40ed4c4dc9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QQmlIncubatorPrivate refcountedLars Knoll2013-10-151-1/+1
| | | | | | | | | This fixes possible bugs and crashes where the incubator could get deleted through GC while constructing the component. Change-Id: Ibe0c5d4e172f0b5505ace0c3ea0369169b8b48a5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of the first half of QQmlGuard usageLars Knoll2013-07-051-1/+1
| | | | | | | | | 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>
* 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>
* Contruct per-delegate QQmlContextData directly.Andrew den Exter2012-05-241-0/+2
| | | | | | | | | | The QQmlContext object created per item is a weighty (QObject) wrapper around QQmlContextData that isn't utilized except as an intermeditrary for the QQmlComponent API. By duplicating a little code out of QQmlComponent we can avoid the need to ever contruct the wrapper. Change-Id: I74558c7e746ead2c5127a8754d5f04550b8f4d10 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Add QQmlEngine::trimComponentCache()Matthew Vogt2012-05-171-1/+1
| | | | | | | | | | | | Allow unused data in the engine's component cache to be safely discarded so that the memory can be freed for other purposes. Unloading of scripts that are no longer required after trimming unused components is not yet supported. Task-number: QTBUG-25653 Change-Id: I37bc9d5592eeb5edceeb34d010a555dcffd11cea Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-241-0/+106
Symbols beginning with QDeclarative are already exported by the quick1 module. Users can apply the bin/rename-qtdeclarative-symbols.sh script to modify client code using the previous names of the renamed symbols. Task-number: QTBUG-23737 Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66 Reviewed-by: Martin Jones <martin.jones@nokia.com>