Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquickitemparticle_p.h |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||
2 | ** | - | ||||||
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||
4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||
5 | ** | - | ||||||
6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - | ||||||
7 | ** | - | ||||||
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||
9 | ** Commercial License Usage | - | ||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||
15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||
16 | ** | - | ||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
19 | ** General Public License version 3 as published by the Free Software | - | ||||||
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||
21 | ** packaging of this file. Please review the following information to | - | ||||||
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||
24 | ** | - | ||||||
25 | ** GNU General Public License Usage | - | ||||||
26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||
27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||
28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||
29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||
31 | ** included in the packaging of this file. Please review the following | - | ||||||
32 | ** information to ensure the GNU General Public License requirements will | - | ||||||
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||
35 | ** | - | ||||||
36 | ** $QT_END_LICENSE$ | - | ||||||
37 | ** | - | ||||||
38 | ****************************************************************************/ | - | ||||||
39 | - | |||||||
40 | #ifndef ITEMPARTICLE_H | - | ||||||
41 | #define ITEMPARTICLE_H | - | ||||||
42 | - | |||||||
43 | // | - | ||||||
44 | // W A R N I N G | - | ||||||
45 | // ------------- | - | ||||||
46 | // | - | ||||||
47 | // This file is not part of the Qt API. It exists purely as an | - | ||||||
48 | // implementation detail. This header file may change from version to | - | ||||||
49 | // version without notice, or even be removed. | - | ||||||
50 | // | - | ||||||
51 | // We mean it. | - | ||||||
52 | // | - | ||||||
53 | #include "qquickparticlepainter_p.h" | - | ||||||
54 | #include <QPointer> | - | ||||||
55 | #include <QSet> | - | ||||||
56 | #include <private/qquickanimation_p_p.h> | - | ||||||
57 | QT_BEGIN_NAMESPACE | - | ||||||
58 | - | |||||||
59 | class QQuickVisualDataModel; | - | ||||||
60 | class QQuickItemParticleAttached; | - | ||||||
61 | - | |||||||
62 | class QQuickItemParticle : public QQuickParticlePainter | - | ||||||
63 | { | - | ||||||
64 | Q_OBJECT | - | ||||||
65 | Q_PROPERTY(bool fade READ fade WRITE setFade NOTIFY fadeChanged) | - | ||||||
66 | Q_PROPERTY(QQmlComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) | - | ||||||
67 | public: | - | ||||||
68 | explicit QQuickItemParticle(QQuickItem *parent = 0); | - | ||||||
69 | ~QQuickItemParticle(); | - | ||||||
70 | - | |||||||
71 | bool fade() const { return m_fade; } never executed: return m_fade; | 0 | ||||||
72 | - | |||||||
73 | QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override; | - | ||||||
74 | - | |||||||
75 | static QQuickItemParticleAttached *qmlAttachedProperties(QObject *object); | - | ||||||
76 | QQmlComponent* delegate() const | - | ||||||
77 | { | - | ||||||
78 | return m_delegate; never executed: return m_delegate; | 0 | ||||||
79 | } | - | ||||||
80 | - | |||||||
81 | Q_SIGNALS: | - | ||||||
82 | void fadeChanged(); | - | ||||||
83 | - | |||||||
84 | void delegateChanged(QQmlComponent* arg); | - | ||||||
85 | - | |||||||
86 | public Q_SLOTS: | - | ||||||
87 | //TODO: Add a follow mode, where moving the delegate causes the logical particle to go with it? | - | ||||||
88 | void freeze(QQuickItem* item); | - | ||||||
89 | void unfreeze(QQuickItem* item); | - | ||||||
90 | void take(QQuickItem* item,bool prioritize=false);//take by modelparticle | - | ||||||
91 | void give(QQuickItem* item);//give from modelparticle | - | ||||||
92 | - | |||||||
93 | void setFade(bool arg){if (arg == m_fade) return; m_fade = arg; Q_EMIT fadeChanged();} never executed: return; never executed: end of block
| 0 | ||||||
94 | void setDelegate(QQmlComponent* arg) | - | ||||||
95 | { | - | ||||||
96 | if (m_delegate != arg) {
| 0-6 | ||||||
97 | m_delegate = arg; | - | ||||||
98 | Q_EMIT delegateChanged(arg); | - | ||||||
99 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||
100 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||
101 | - | |||||||
102 | protected: | - | ||||||
103 | void reset() override; | - | ||||||
104 | void commit(int gIdx, int pIdx) override; | - | ||||||
105 | void initialize(int gIdx, int pIdx) override; | - | ||||||
106 | void prepareNextFrame(); | - | ||||||
107 | private: | - | ||||||
108 | void processDeletables(); | - | ||||||
109 | void tick(int time = 0); | - | ||||||
110 | QList<QQuickItem* > m_deletables; | - | ||||||
111 | QList<QQuickItem* > m_managed; | - | ||||||
112 | QList< QQuickParticleData* > m_loadables; | - | ||||||
113 | bool m_fade; | - | ||||||
114 | - | |||||||
115 | QList<QQuickItem*> m_pendingItems; | - | ||||||
116 | QList<int> m_available; | - | ||||||
117 | QSet<QQuickItem*> m_stasis; | - | ||||||
118 | qreal m_lastT; | - | ||||||
119 | int m_activeCount; | - | ||||||
120 | QQmlComponent* m_delegate; | - | ||||||
121 | - | |||||||
122 | typedef QTickAnimationProxy<QQuickItemParticle, &QQuickItemParticle::tick> Clock; | - | ||||||
123 | Clock *clock; | - | ||||||
124 | }; | - | ||||||
125 | - | |||||||
126 | class QQuickItemParticleAttached : public QObject | - | ||||||
127 | { | - | ||||||
128 | Q_OBJECT | - | ||||||
129 | Q_PROPERTY(QQuickItemParticle* particle READ particle CONSTANT); | - | ||||||
130 | public: | - | ||||||
131 | QQuickItemParticleAttached(QObject* parent) | - | ||||||
132 | : QObject(parent), m_mp(0) | - | ||||||
133 | {;} executed 2472 times by 1 test: end of block Executed by:
| 2472 | ||||||
134 | QQuickItemParticle* particle() const { return m_mp; } never executed: return m_mp; | 0 | ||||||
135 | void detach(){Q_EMIT detached();} executed 1716 times by 1 test: end of block Executed by:
| 1716 | ||||||
136 | void attach(){Q_EMIT attached();} executed 3176 times by 1 test: end of block Executed by:
| 3176 | ||||||
137 | private: | - | ||||||
138 | QQuickItemParticle* m_mp; | - | ||||||
139 | friend class QQuickItemParticle; | - | ||||||
140 | Q_SIGNALS: | - | ||||||
141 | void detached(); | - | ||||||
142 | void attached(); | - | ||||||
143 | }; | - | ||||||
144 | - | |||||||
145 | QT_END_NAMESPACE | - | ||||||
146 | - | |||||||
147 | QML_DECLARE_TYPEINFO(QQuickItemParticle, QML_HAS_ATTACHED_PROPERTIES) | - | ||||||
148 | - | |||||||
149 | #endif // ITEMPARTICLE_H | - | ||||||
Source code | Switch to Preprocessed file |