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
qquickparticlegroup.cpp
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#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
5
7
59 : QQuickStochasticState(parent)
60 , m_system(nullptr)
61{
62
63}
64
65void delayedRedirect(QQmlListProperty<QObject> *prop, QObject *value)
66{
67 QQuickParticleGroup* pg = qobject_cast<QQuickParticleGroup*>(prop->object);
68 if (pg)
69 pg->delayRedirect(value);
70}
71
72QQmlListProperty<QObject> QQuickParticleGroup::particleChildren()
73{
74 QQuickParticleSystem* system = qobject_cast<QQuickParticleSystem*>(parent());
75 if (system) {
76 return QQmlListProperty<QObject>(this, nullptr,
78 nullptr, nullptr, nullptr, nullptr);
79 } else {
80 return QQmlListProperty<QObject>(this, nullptr,
81 &delayedRedirect, nullptr, nullptr,
82 nullptr, nullptr, nullptr);
83 }
84}
85
87{
88 if (m_system != arg) {
89 m_system = arg;
90 m_system->registerParticleGroup(this);
91 performDelayedRedirects();
93 }
94}
95
97{
98 m_delayedRedirects << obj;
99}
100
101void QQuickParticleGroup::performDelayedRedirects()
102{
103 if (!m_system)
104 return;
105 foreach (QObject* obj, m_delayedRedirects)
106 m_system->stateRedirect(this, m_system, obj);
107
108 m_delayedRedirects.clear();
109}
110
112 if (!m_system && qobject_cast<QQuickParticleSystem*>(parent()))
113 setSystem(qobject_cast<QQuickParticleSystem*>(parent()));
114}
115
116#include "moc_qquickparticlegroup_p.cpp"
void clear()
Definition qlist.h:434
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
void setSystem(QQuickParticleSystem *arg)
void systemChanged(QQuickParticleSystem *arg)
QQmlListProperty< QObject > particleChildren
void delayRedirect(QObject *obj)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
QQuickParticleGroup(QObject *parent=nullptr)
\qmltype ParticleGroup \instantiates QQuickParticleGroup \inqmlmodule QtQuick.Particles
QQuickParticleSystem * system
void registerParticleGroup(QQuickParticleGroup *g)
static void stateRedirect(QQuickParticleGroup *group, QQuickParticleSystem *sys, QObject *value)
static void statePropertyRedirect(QQmlListProperty< QObject > *prop, QObject *value)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLhandleARB obj
[2]
void delayedRedirect(QQmlListProperty< QObject > *prop, QObject *value)
SSL_CTX int void * arg
#define emit
QObject::connect nullptr