1 | // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). |
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 QUICKANIMATIONERNODEFACTORY_H |
5 | #define QUICKANIMATIONERNODEFACTORY_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 for the convenience |
12 | // of other Qt classes. 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 <private/qabstractnodefactory_p.h> |
19 | #include <QtQml/private/qqmlmetatype_p.h> |
20 | #include <QtCore/qhash.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QQmlType; |
25 | |
26 | namespace Qt3DAnimation { |
27 | |
28 | class QuickAnimationNodeFactory : public Qt3DCore::QAbstractNodeFactory |
29 | { |
30 | public: |
31 | Qt3DCore::QNode *createNode(const char *type) override; |
32 | |
33 | void registerType(const char *className, const char *quickName, int major, int minor); |
34 | |
35 | static QuickAnimationNodeFactory *instance(); |
36 | |
37 | private: |
38 | struct Type { |
39 | Type() : t(nullptr), resolved(false) { } |
40 | Type(const char *quickName, int major, int minor) |
41 | : quickName(quickName), version(major, minor), t(nullptr), resolved(false) { } |
42 | QByteArray quickName; |
43 | QPair<int, int> version; |
44 | QQmlType t; |
45 | bool resolved; |
46 | }; |
47 | QHash<QByteArray, Type> m_types; |
48 | }; |
49 | |
50 | } // namespace Qt3DAnimation |
51 | |
52 | QT_END_NAMESPACE |
53 | |
54 | #endif // QUICKANIMATIONERNODEFACTORY_H |
55 | |