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.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_H
5#define QQMLINCUBATOR_H
6
7#include <QtQml/qtqmlglobal.h>
8#include <QtQml/qqmlerror.h>
9#include <atomic>
10
12
13
14class QQmlEngine;
16class QVariant;
17
19class Q_QML_EXPORT QQmlIncubator
20{
21 Q_DISABLE_COPY(QQmlIncubator)
22public:
23 enum IncubationMode {
24 Asynchronous,
25 AsynchronousIfNested,
26 Synchronous
27 };
34
35 QQmlIncubator(IncubationMode = Asynchronous);
36 virtual ~QQmlIncubator();
37
38 void clear();
39 void forceCompletion();
40
41 bool isNull() const;
42 bool isReady() const;
43 bool isError() const;
44 bool isLoading() const;
45
46 QList<QQmlError> errors() const;
47
49
50 Status status() const;
51
52 QObject *object() const;
53
54 void setInitialProperties(const QVariantMap &initialProperties);
55
56protected:
57 virtual void statusChanged(Status);
58 virtual void setInitialState(QObject *);
59
60private:
61 friend class QQmlComponent;
62 friend class QQmlEnginePrivate;
65};
66
68class Q_QML_EXPORT QQmlIncubationController
69{
70 Q_DISABLE_COPY(QQmlIncubationController)
71public:
72 QQmlIncubationController();
73 virtual ~QQmlIncubationController();
74
75 QQmlEngine *engine() const;
76 int incubatingObjectCount() const;
77
78 void incubateFor(int msecs);
79 void incubateWhile(std::atomic<bool> *flag, int msecs = 0);
80
81protected:
82 virtual void incubatingObjectCountChanged(int);
83
84private:
85 friend class QQmlEngine;
86 friend class QQmlEnginePrivate;
89};
90
91QT_END_NAMESPACE
92
93#endif // QQMLINCUBATOR_H
\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.
QQmlEngine * engine() const
Return the QQmlEngine this incubation controller is set on, or 0 if it has not been set on any engine...
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.
bool isError() const
Returns true if the incubator's status() is Error.
virtual void setInitialState(QObject *)
Called after the object is first created, but before complex property bindings are evaluated and,...
bool isNull() const
Returns true if the incubator's status() is Null.
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:91
bool shouldInterrupt() const
Definition qqmlvme_p.h:101
QQmlInstantiationInterrupt(QDeadlineTimer deadline)
Definition qqmlvme_p.h:96
bool isOK() const
Definition qqmlvme.cpp:76
void guard(QQmlObjectCreator *)
Definition qqmlvme.cpp:50
void clear()
Definition qqmlvme.cpp:65
void clear()
Clears the entire result set and releases any associated resources.
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)
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)