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
qquick3druntimeloader_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QQUICK3DRUNTIMELOADER_H
7#define QQUICK3DRUNTIMELOADER_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtQuick3D/private/qquick3dmodel_p.h>
21#include <QtQuick3D/private/qquick3dinstancing_p.h>
22
24
25#include <QtCore/qpointer.h>
26#include <QtCore/qlist.h>
27#if QT_CONFIG(mimetype)
28#include <QtCore/qmimetype.h>
29#endif
30
32
33class Q_QUICK3DASSETUTILS_EXPORT QQuick3DRuntimeLoader : public QQuick3DNode
34{
35 Q_OBJECT
36
37 QML_NAMED_ELEMENT(RuntimeLoader)
38 QML_ADDED_IN_VERSION(6, 2)
39
40 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
41 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
42 Q_PROPERTY(QString errorString READ errorString NOTIFY errorStringChanged)
43 Q_PROPERTY(QQuick3DBounds3 bounds READ bounds NOTIFY boundsChanged)
44 Q_PROPERTY(QQuick3DInstancing *instancing READ instancing WRITE setInstancing NOTIFY instancingChanged)
45 Q_PROPERTY(QStringList supportedExtensions READ supportedExtensions CONSTANT REVISION(6, 7))
46#if QT_CONFIG(mimetype)
47 Q_PROPERTY(QList<QMimeType> supportedMimeTypes READ supportedMimeTypes CONSTANT REVISION(6, 7))
48#endif
49
50public:
51 explicit QQuick3DRuntimeLoader(QQuick3DNode *parent = nullptr);
52
53 QUrl source() const;
54 void setSource(const QUrl &newSource);
55 void componentComplete() override;
56 Q_REVISION(6, 7) static QStringList supportedExtensions();
57#if QT_CONFIG(mimetype)
58 Q_REVISION(6, 7) static QList<QMimeType> supportedMimeTypes();
59#endif
60
61 enum class Status { Empty, Success, Error };
62 Q_ENUM(Status)
63 Status status() const;
64 QString errorString() const;
65 const QQuick3DBounds3 &bounds() const;
66
67 QQuick3DInstancing *instancing() const;
68 void setInstancing(QQuick3DInstancing *newInstancing);
69
70Q_SIGNALS:
71 void sourceChanged();
72 void statusChanged();
73 void errorStringChanged();
74 void boundsChanged();
75 void instancingChanged();
76
77protected:
78 QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
79
80private:
81 void calculateBounds();
82 void loadSource();
83 void updateModels();
84
85 QPointer<QQuick3DNode> m_root;
86 QPointer<QQuick3DNode> m_imported;
87 QString m_assetId; // Used to release runtime assets in the buffer manager.
88 QUrl m_source;
89 Status m_status = Status::Empty;
90 QString m_errorString;
91 bool m_boundsDirty = false;
92 QQuick3DBounds3 m_bounds;
93 QQuick3DInstancing *m_instancing = nullptr;
94 bool m_instancingChanged = false;
95};
96
97QT_END_NAMESPACE
98
99#endif // QQUICK3DRUNTIMELOADER_H
Combined button and popup list for selecting options.
static void boxBoundsRecursive(const QQuick3DNode *baseNode, const QQuick3DNode *node, QQuick3DBounds3 &accBounds)
static void applyToModels(QQuick3DObject *obj, Func &&lambda)