Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquick3dloader_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QQUICK3DLOADER_P_H
5#define QQUICK3DLOADER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick3D/private/qquick3dnode_p.h>
19#include <QQmlIncubator>
20#include <private/qqmlguard_p.h>
21
22#include <private/qv4value_p.h>
23
25class QQuick3DLoader;
27{
28public:
31
32protected:
33 void statusChanged(Status) override;
34 void setInitialState(QObject *) override;
35
36private:
37 QQuick3DLoader *m_loader;
38};
39
40class QQmlContext;
41
42class Q_QUICK3D_EXPORT QQuick3DLoader : public QQuick3DNode
43{
45
46 Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
47 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
48 Q_PROPERTY(QQmlComponent *sourceComponent READ sourceComponent WRITE setSourceComponent RESET resetSourceComponent NOTIFY sourceComponentChanged)
49 Q_PROPERTY(QObject *item READ item NOTIFY itemChanged)
50 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
51 Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
52 Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
53
54 QML_NAMED_ELEMENT(Loader3D)
55
56public:
57 explicit QQuick3DLoader(QQuick3DNode *parent = nullptr);
58 ~QQuick3DLoader() override;
59
60 bool active() const;
61 void setActive(bool newVal);
62
63 Q_INVOKABLE void setSource(QQmlV4FunctionPtr);
64
65 QUrl source() const;
66 void setSource(const QUrl &);
67
68 QQmlComponent *sourceComponent() const;
69 void setSourceComponent(QQmlComponent *);
70 void resetSourceComponent();
71
72 enum Status { Null, Ready, Loading, Error };
73 Q_ENUM(Status)
74 Status status() const;
75 qreal progress() const;
76
77 bool asynchronous() const;
78 void setAsynchronous(bool a);
79
80 QObject *item() const;
81
89 void loaded();
91
92protected:
93 void componentComplete() override;
94
95private Q_SLOTS:
96 void sourceLoaded();
97
98private:
99 Q_DISABLE_COPY(QQuick3DLoader)
101 void setSource(const QUrl &sourceUrl, bool needsClear);
102 void loadFromSource();
103 void loadFromSourceComponent();
104 void clear();
105 void load();
106
107 void incubatorStateChanged(QQmlIncubator::Status status);
108 void setInitialState(QObject *obj);
109 void disposeInitialPropertyValues();
110 static QUrl resolveSourceUrl(QQmlV4FunctionPtr args);
111 QV4::ReturnedValue extractInitialPropertyValues(QQmlV4FunctionPtr args, bool *error);
112
113 void createComponent();
114
115 QUrl m_source;
116 QQuick3DNode *m_item;
117 QObject *m_object;
118 QQmlStrongJSQObjectReference<QQmlComponent> m_component;
119 QQmlContext *m_itemContext;
120 QQuick3DLoaderIncubator *m_incubator;
121 QV4::PersistentValue m_initialPropertyValues;
122 QV4::PersistentValue m_qmlCallingContext;
123 bool m_active : 1;
124 bool m_loadingFromSource : 1;
125 bool m_asynchronous : 1;
126};
127
129
131
132#endif // QQUICK3DLOADER_P_H
bool m_active
\inmodule QtCore
Definition qobject.h:103
The QQmlComponent class encapsulates a QML component definition.
The QQmlContext class defines a context within a QML engine.
Definition qqmlcontext.h:25
The QQmlIncubator class allows QML objects to be created asynchronously.
IncubationMode
Specifies the mode the incubator operates in.
Status
Specifies the status of the QQmlIncubator.
void statusChanged(Status) override
Called when the status of the incubator changes.
void setInitialState(QObject *) override
Called after the object is first created, but before complex property bindings are evaluated and,...
QQuick3DLoaderIncubator(QQuick3DLoader *l, IncubationMode mode)
void activeChanged()
void asynchronousChanged()
void itemChanged()
void statusChanged()
void sourceChanged()
void sourceComponentChanged()
void progressChanged()
\inmodule QtCore
Definition qurl.h:94
void statusChanged(QQmlComponent::Status status)
[1]
Definition qlogging.cpp:11
b clear()
p1 load("image.bmp")
Combined button and popup list for selecting options.
quint64 ReturnedValue
DBusConnection const char DBusError * error
GLenum mode
GLboolean GLboolean GLboolean GLboolean a
[7]
GLsizei GLsizei GLchar * source
GLhandleARB obj
[2]
#define QML_DECLARE_TYPE(TYPE)
Definition qqml.h:19
#define QML_NAMED_ELEMENT(NAME)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
#define explicit
QGraphicsItem * item
QJSValueList args