diff options
Diffstat (limited to 'src/particles/qquickparticleaffector_p.h')
-rw-r--r-- | src/particles/qquickparticleaffector_p.h | 54 |
1 files changed, 12 insertions, 42 deletions
diff --git a/src/particles/qquickparticleaffector_p.h b/src/particles/qquickparticleaffector_p.h index 5c9652bc32..5bd7c81940 100644 --- a/src/particles/qquickparticleaffector_p.h +++ b/src/particles/qquickparticleaffector_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef PARTICLEAFFECTOR_H #define PARTICLEAFFECTOR_H @@ -52,13 +16,14 @@ // #include <QObject> +#include <QSet> #include "qquickparticlesystem_p.h" #include "qquickparticleextruder_p.h" #include "qtquickparticlesglobal_p.h" QT_BEGIN_NAMESPACE -class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleAffector : public QQuickItem +class Q_QUICKPARTICLES_EXPORT QQuickParticleAffector : public QQuickItem { Q_OBJECT Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged) @@ -68,8 +33,12 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleAffector : public QQuickItem Q_PROPERTY(bool once READ onceOff WRITE setOnceOff NOTIFY onceChanged) Q_PROPERTY(QQuickParticleExtruder* shape READ shape WRITE setShape NOTIFY shapeChanged) + QML_NAMED_ELEMENT(ParticleAffector) + QML_ADDED_IN_VERSION(2, 0) + QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.") + public: - explicit QQuickParticleAffector(QQuickItem *parent = 0); + explicit QQuickParticleAffector(QQuickItem *parent = nullptr); virtual void affectSystem(qreal dt); virtual void reset(QQuickParticleData*);//As some store their own data per particle? QQuickParticleSystem* system() const @@ -123,7 +92,8 @@ void setSystem(QQuickParticleSystem* arg) { if (m_system != arg) { m_system = arg; - m_system->registerParticleAffector(this); + if (m_system) + m_system->registerParticleAffector(this); Q_EMIT systemChanged(arg); } } @@ -191,7 +161,7 @@ protected: static const qreal simulationCutoff; QPointF m_offset; - QSet<QPair<int, int> > m_onceOffed; + QSet<QPair<int, int>> m_onceOffed; private: QSet<int> m_groupIds; bool m_updateIntSet; |