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 QQMLCOMPONENTATTACHED_P_H |
5 | #define QQMLCOMPONENTATTACHED_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 <QtQml/qqml.h> |
19 | #include <private/qtqmlglobal_p.h> |
20 | #include <QtCore/QObject> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | |
25 | // implemented in qqmlcomponent.cpp |
26 | class Q_QML_PRIVATE_EXPORT QQmlComponentAttached : public QObject |
27 | { |
28 | Q_OBJECT |
29 | |
30 | // Used as attached object for QQmlComponent. We want qqmlcomponentattached_p.h to be #include'd |
31 | // when registering QQmlComponent, but we cannot #include it from qqmlcomponent.h. Therefore we |
32 | // force an anonymous type registration here. |
33 | QML_ANONYMOUS |
34 | QML_ADDED_IN_VERSION(2, 0) |
35 | Q_CLASSINFO("QML.OmitFromQmlTypes" , "true" ) |
36 | public: |
37 | QQmlComponentAttached(QObject *parent = nullptr); |
38 | ~QQmlComponentAttached(); |
39 | |
40 | void insertIntoList(QQmlComponentAttached **listHead) |
41 | { |
42 | m_prev = listHead; |
43 | m_next = *listHead; |
44 | *listHead = this; |
45 | if (m_next) |
46 | m_next->m_prev = &m_next; |
47 | } |
48 | |
49 | void removeFromList() |
50 | { |
51 | *m_prev = m_next; |
52 | if (m_next) |
53 | m_next->m_prev = m_prev; |
54 | m_next = nullptr; |
55 | m_prev = nullptr; |
56 | } |
57 | |
58 | QQmlComponentAttached *next() const { return m_next; } |
59 | |
60 | Q_SIGNALS: |
61 | void completed(); |
62 | void destruction(); |
63 | |
64 | private: |
65 | QQmlComponentAttached **m_prev; |
66 | QQmlComponentAttached *m_next; |
67 | }; |
68 | |
69 | QT_END_NAMESPACE |
70 | |
71 | #endif // QQMLCOMPONENTATTACHED_P_H |
72 | |