Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlincubator_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQMLINCUBATOR_P_H
5#define QQMLINCUBATOR_P_H
6
8
9#include <private/qintrusivelist_p.h>
10#include <private/qqmlvme_p.h>
11#include <private/qrecursionwatcher_p.h>
12#include <private/qqmlengine_p.h>
13#include <private/qqmlguardedcontextdata_p.h>
14
15#include <QtCore/qpointer.h>
16
17//
18// W A R N I N G
19// -------------
20//
21// This file is not part of the Qt API. It exists purely as an
22// implementation detail. This header file may change from version to
23// version without notice, or even be removed.
24//
25// We mean it.
26//
27
29
31
32class QQmlIncubator;
33class Q_QML_EXPORT QQmlIncubatorPrivate : public QQmlEnginePrivate::Incubator, public QSharedData
34{
35public:
36 QQmlIncubatorPrivate(QQmlIncubator *q, QQmlIncubator::IncubationMode m);
37 ~QQmlIncubatorPrivate();
38
39 inline static QQmlIncubatorPrivate *get(QQmlIncubator *incubator) { return incubator->d; }
40
41 int subComponentToCreate;
42 QQmlIncubator *q;
43
44 QQmlIncubator::Status calculateStatus() const;
45 void changeStatus(QQmlIncubator::Status);
46 QQmlIncubator::Status status;
47
48 QQmlIncubator::IncubationMode mode;
49 bool isAsynchronous;
50 enum Progress : char { Execute, Completing, Completed };
51 Progress progress;
52
53 QList<QQmlError> errors;
54
55
56 QPointer<QObject> result;
57 enum HadTopLevelRequired : bool {No = 0, Yes = 1};
58 /* TODO: unify with Creator pointer once QTBUG-108760 is implemented
59 though we don't acutally own the properties here; if we ever end up
60 with a use case for async incubation of C++ types, we however could
61 not rely on the component to still exist during incubation, and
62 would need to store a copy of the required properties instead
63 */
64 QTaggedPointer<RequiredProperties, HadTopLevelRequired> requiredPropertiesFromComponent;
65 QQmlGuardedContextData rootContext;
66 QQmlEnginePrivate *enginePriv;
67 QQmlRefPointer<QV4::ExecutableCompilationUnit> compilationUnit;
68 QScopedPointer<QQmlObjectCreator> creator;
69 QQmlVMEGuard vmeGuard;
70
71 QExplicitlySharedDataPointer<QQmlIncubatorPrivate> waitingOnMe;
72 typedef QQmlEnginePrivate::Incubator QIPBase;
73 QIntrusiveListNode nextWaitingFor;
74 QIntrusiveList<QQmlIncubatorPrivate, &QQmlIncubatorPrivate::nextWaitingFor> waitingFor;
75
76 QRecursionNode recursion;
77 QVariantMap initialProperties;
78
79 void clear();
80
81 void forceCompletion(QQmlInstantiationInterrupt &i);
82 void incubate(QQmlInstantiationInterrupt &i);
83 void incubateCppBasedComponent(QQmlComponent *component, QQmlContext *context);
84 RequiredProperties *requiredProperties();
85 bool hadTopLevelRequiredProperties() const;
86};
87
88QT_END_NAMESPACE
89
90#endif // QQMLINCUBATOR_P_H
QJSEngine * engine() const
Returns the QJSEngine this QJSManagedValue belongs to.
bool isError() const
Returns true if this value represents a JavaScript Error object, or false otherwise.
bool isNull() const
Returns true if this QJSManagedValue holds the JavaScript null value, or false otherwise.
\inmodule QtCore
Definition qobject.h:105
void setInitialState(QObject *o) override
Called after the object is first created, but before complex property bindings are evaluated and,...
void statusChanged(Status s) override
Called when the status of the incubator changes.
QQmlComponentIncubator(QV4::Heap::QmlIncubatorObject *inc, IncubationMode mode)
QV4::PersistentValue incubatorObject
The QQmlComponent class encapsulates a QML component definition.
The QQmlError class encapsulates a QML error.
Definition qqmlerror.h:18
QQmlIncubationController instances drive the progress of QQmlIncubators.
void incubateFor(int msecs)
Incubate objects for msecs, or until there are no more objects to incubate.
int incubatingObjectCount() const
Return the number of objects currently incubating.
void incubateWhile(std::atomic< bool > *flag, int msecs=0)
The QQmlIncubator class allows QML objects to be created asynchronously.
QList< QQmlError > errors() const
Return the list of errors encountered while incubating the object.
void setInitialProperties(const QVariantMap &initialProperties)
Stores a mapping from property names to initial values, contained in initialProperties,...
friend class QQmlEnginePrivate
friend class QQmlIncubatorPrivate
virtual ~QQmlIncubator()
QObject * object() const
Return the incubated object if the status is Ready, otherwise 0.
bool isLoading() const
Returns true if the incubator's status() is Loading.
virtual void setInitialState(QObject *)
Called after the object is first created, but before complex property bindings are evaluated and,...
void forceCompletion()
Force any in-progress incubation to finish synchronously.
Status status() const
Return the current status of the incubator.
Status
Specifies the status of the QQmlIncubator.
IncubationMode incubationMode() const
Return the incubation mode passed to the QQmlIncubator constructor.
bool isReady() const
Returns true if the incubator's status() is Ready.
QQmlInstantiationInterrupt(std::atomic< bool > *runWhile, QDeadlineTimer deadline=QDeadlineTimer::Forever)
Definition qqmlvme_p.h:92
bool shouldInterrupt() const
Definition qqmlvme_p.h:102
QQmlInstantiationInterrupt(QDeadlineTimer deadline)
Definition qqmlvme_p.h:97
bool isOK() const
Definition qqmlvme.cpp:77
void guard(QQmlObjectCreator *)
Definition qqmlvme.cpp:51
void clear()
Definition qqmlvme.cpp:66
void clear()
Clears the entire result set and releases any associated resources.
Combined button and popup list for selecting options.
DECLARE_HEAP_OBJECT(QmlContext, ExecutionContext)
Definition qjsvalue.h:23
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
static void removePendingQPropertyBinding(QV4::Value *object, const QString &propertyName, const QQmlObjectCreator *creator)
static void QQmlComponent_setQmlParent(QObject *me, QObject *parent)
DEFINE_OBJECT_VTABLE(QV4::QmlIncubatorObject)
V4_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension)
static QQmlParserStatus * parserStatusCast(const QQmlType &type, QObject *rv)
QDebug Q_QML_EXPORT operator<<(QDebug debug, const QQmlError &error)
double d
[1]
static ReturnedValue method_set_statusChanged(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_get_status(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
static ReturnedValue method_get_object(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)
void statusChanged(QQmlIncubator::Status)
void setInitialState(QObject *, RequiredProperties *requiredProperties)
static ReturnedValue method_forceCompletion(const FunctionObject *, const Value *thisObject, const Value *argv, int argc)