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
qquickitemparticle_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 ITEMPARTICLE_H
5#define ITEMPARTICLE_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//
18#include <QPointer>
19#include <QSet>
20#include <private/qquickanimation_p_p.h>
22
24
25class Q_QUICKPARTICLES_EXPORT QQuickItemParticle : public QQuickParticlePainter
26{
28 Q_PROPERTY(bool fade READ fade WRITE setFade NOTIFY fadeChanged)
29 Q_PROPERTY(QQmlComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
30 QML_NAMED_ELEMENT(ItemParticle)
33public:
34 explicit QQuickItemParticle(QQuickItem *parent = nullptr);
36
37 bool fade() const { return m_fade; }
38
39 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
40
41 static QQuickItemParticleAttached *qmlAttachedProperties(QObject *object);
43 {
44 return m_delegate;
45 }
46
49
51
52public Q_SLOTS:
53 //TODO: Add a follow mode, where moving the delegate causes the logical particle to go with it?
54 void freeze(QQuickItem* item);
55 void unfreeze(QQuickItem* item);
56 void take(QQuickItem* item,bool prioritize=false);//take by modelparticle
57 void give(QQuickItem* item);//give from modelparticle
58
59 void setFade(bool arg){if (arg == m_fade) return; m_fade = arg; Q_EMIT fadeChanged();}
61 {
62 if (m_delegate != arg) {
64 Q_EMIT delegateChanged(arg);
65 }
66 }
67
68protected:
69 void reset() override;
70 void commit(int gIdx, int pIdx) override;
71 void initialize(int gIdx, int pIdx) override;
72 void prepareNextFrame();
73private:
74 bool clockShouldUpdate() const;
75 void updateClock();
76 void reconnectSystem(QQuickParticleSystem *system);
77 void reconnectParent(QQuickItem *parent);
78 void processDeletables();
79 void tick(int time = 0);
80 QSet<QQuickItem* > m_deletables;
81 QList<QQuickItem* > m_managed;
82 bool m_fade;
83
84 QList<QQuickItem*> m_pendingItems;
85 QSet<QQuickItem*> m_stasis;
86 qreal m_lastT;
87 int m_activeCount;
89
90 typedef QTickAnimationProxy<QQuickItemParticle, &QQuickItemParticle::tick> Clock;
91 Clock *clock;
92 QMetaObject::Connection m_systemRunStateConnection;
93 QMetaObject::Connection m_systemPauseStateConnection;
94 QMetaObject::Connection m_systemEnabledStateConnection;
95 QMetaObject::Connection m_parentEnabledStateConnection;
96};
97
99{
102public:
104 : QObject(parent), m_mp(0), m_parentItem(nullptr)
105 {;}
106 QQuickItemParticle* particle() const { return m_mp; }
109private:
110 QQuickItemParticle* m_mp;
111 QPointer<QQuickItem> m_parentItem;
112 friend class QQuickItemParticle;
114 void detached();
115 void attached();
116};
117
119
120#endif // ITEMPARTICLE_H
DarwinBluetooth::DeviceInquiryDelegate * m_delegate
\inmodule QtCore Represents a handle to a signal-slot (or signal-functor) connection.
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
The QQmlComponent class encapsulates a QML component definition.
QQuickItemParticleAttached(QObject *parent)
QQuickItemParticle * particle() const
QQmlComponent * delegate() const
void setDelegate(QQmlComponent *arg)
void delegateChanged(QQmlComponent *arg)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
Combined button and popup list for selecting options.
static bool initialize()
Definition qctf.cpp:94
GLint GLint GLint GLint GLsizei GLsizei GLsizei GLboolean commit
GLboolean reset
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define QML_ATTACHED(ATTACHED_TYPE)
SSL_CTX int void * arg
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_EMIT
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
#define explicit
QObject::connect nullptr
QGraphicsItem * item