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
qquickparticlepainter_p.h
Go to the documentation of this file.
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 PARTICLE_H
5#define PARTICLE_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 <QObject>
19#include <QDebug>
20#include <QPair>
22
24
25class Q_QUICKPARTICLES_EXPORT QQuickParticlePainter : public QQuickItem
26{
28 Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
29 Q_PROPERTY(QStringList groups READ groups WRITE setGroups NOTIFY groupsChanged)
30
31 QML_NAMED_ELEMENT(ParticlePainter)
33 QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.")
34
35public: // data
37
38public:
39 explicit QQuickParticlePainter(QQuickItem *parent = nullptr);
40 //Data Interface to system
42 void reload(QQuickParticleData*);
43 void setCount(int c);
44
45 int count() const
46 {
47 return m_count;
48 }
49
50 void performPendingCommits();//Called from updatePaintNode
52 {
53 return m_system;
54 }
55
57 {
58 return m_groups;
59 }
60
61 const GroupIDs &groupIds() const
62 {
63 if (m_groupIdsNeedRecalculation) {
64 recalculateGroupIds();
65 }
66 return m_groupIds;
67 }
68
69 void itemChange(ItemChange, const ItemChangeData &) override;
70
74
76
77public Q_SLOTS:
78 void setSystem(QQuickParticleSystem* arg);
79
80 void setGroups(const QStringList &arg);
81
82 void calcSystemOffset(bool resetPending = false);
83
84private Q_SLOTS:
85 virtual void sceneGraphInvalidated() {}
86
87protected:
88 /* Reset resets all your internal data structures. But anything attached to a particle should
89 be in attached data. So reset + reloads should have no visible effect.
90 ###Hunt down all cases where we do a complete reset for convenience and be more targeted
91 */
92 virtual void reset();
93
94 void componentComplete() override;
95 virtual void initialize(int gIdx, int pIdx){//Called from main thread
96 Q_UNUSED(gIdx);
97 Q_UNUSED(pIdx);
98 }
99 virtual void commit(int gIdx, int pIdx){//Called in Render Thread
100 //###If you need to do something on size changed, check m_data size in this? Or we reset you every time?
101 Q_UNUSED(gIdx);
102 Q_UNUSED(pIdx);
103 }
104
108 bool m_pleaseReset;//Used by subclasses, but it's a nice optimization to know when stuff isn't going to matter.
110
113
114private: // methods
115 void recalculateGroupIds() const;
116
117private: // data
118 QStringList m_groups;
119 QSet<QPair<int,int> > m_pendingCommits;
120 mutable GroupIDs m_groupIds;
121 mutable bool m_groupIdsNeedRecalculation;
122};
123
125#endif // PARTICLE_H
\inmodule QtCore\reentrant
Definition qpoint.h:217
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
void systemChanged(QQuickParticleSystem *arg)
virtual void initialize(int gIdx, int pIdx)
void groupsChanged(const QStringList &arg)
QQuickParticleSystem * system() const
virtual void commit(int gIdx, int pIdx)
const GroupIDs & groupIds() const
QQuickParticleSystem * m_system
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtCore
p1 load("image.bmp")
Combined button and popup list for selecting options.
GLsizei GLuint * groups
GLsizei GLenum GLenum * types
GLenum GLenum GLsizei count
GLenum type
GLboolean reset
const GLubyte * c
#define QML_UNCREATABLE(REASON)
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
SSL_CTX int void * arg
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
#define Q_UNUSED(x)
#define explicit