OpenCoverage

qquickparticlegroup.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquickparticlegroup.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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#include "qquickparticlegroup_p.h"-
41-
42/*!-
43 \qmltype ParticleGroup-
44 \instantiates QQuickParticleGroup-
45 \inqmlmodule QtQuick.Particles-
46 \brief For setting attributes on a logical particle group.-
47 \ingroup qtquick-particles-
48-
49 This element allows you to set timed transitions on particle groups.-
50-
51 You can also use this element to group particle system elements related to the logical-
52 particle group. Emitters, Affectors and Painters set as direct children of a ParticleGroup-
53 will automatically apply to that logical particle group. TrailEmitters will automatically follow-
54 the group.-
55-
56 If a ParticleGroup element is not defined for a group, the group will function normally as if-
57 none of the transition properties were set.-
58*/-
59/*!-
60 \qmlproperty ParticleSystem QtQuick.Particles::ParticleGroup::system-
61 This is the system which will contain the group.-
62-
63 If the ParticleGroup is a direct child of a ParticleSystem, it will automatically be associated with it.-
64*/-
65/*!-
66 \qmlproperty string QtQuick.Particles::ParticleGroup::name-
67 This is the name of the particle group, and how it is generally referred to by other elements.-
68-
69 If elements refer to a name which does not have an explicit ParticleGroup created, it will-
70 work normally (with no transitions specified for the group). If you do not need to assign-
71 duration based transitions to a group, you do not need to create a ParticleGroup with that name (although you may).-
72*/-
73/*!-
74 \qmlproperty int QtQuick.Particles::ParticleGroup::duration-
75 The time in milliseconds before the group will attempt to transition.-
76-
77*/-
78/*!-
79 \qmlproperty ParticleSystem QtQuick.Particles::ParticleGroup::durationVariation-
80 The maximum number of milliseconds that the duration of the transition cycle varies per particle in the group.-
81-
82 Default value is zero.-
83*/-
84/*!-
85 \qmlproperty ParticleSystem QtQuick.Particles::ParticleGroup::to-
86 The weighted list of transitions valid for this group.-
87-
88 If the chosen transition stays in this group, another duration (+/- up to durationVariation)-
89 milliseconds will occur before another transition is attempted.-
90*/-
91-
92QQuickParticleGroup::QQuickParticleGroup(QObject* parent)-
93 : QQuickStochasticState(parent)-
94 , m_system(nullptr)-
95{-
96-
97}
executed 28 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickparticlegroup
28
98-
99void delayedRedirect(QQmlListProperty<QObject> *prop, QObject *value)-
100{-
101 QQuickParticleGroup* pg = qobject_cast<QQuickParticleGroup*>(prop->object);-
102 if (pg)
pgDescription
TRUEnever evaluated
FALSEnever evaluated
0
103 pg->delayRedirect(value);
never executed: pg->delayRedirect(value);
0
104}
never executed: end of block
0
105-
106QQmlListProperty<QObject> QQuickParticleGroup::particleChildren()-
107{-
108 QQuickParticleSystem* system = qobject_cast<QQuickParticleSystem*>(parent());-
109 if (system)
systemDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_examples
FALSEnever evaluated
0-8
110 return QQmlListProperty<QObject>(this, nullptr, &QQuickParticleSystem::statePropertyRedirect, nullptr, nullptr, nullptr);
executed 8 times by 1 test: return QQmlListProperty<QObject>(this, nullptr, &QQuickParticleSystem::statePropertyRedirect, nullptr, nullptr, nullptr);
Executed by:
  • tst_examples
8
111 else-
112 return QQmlListProperty<QObject>(this, nullptr, &delayedRedirect, nullptr, nullptr, nullptr);
never executed: return QQmlListProperty<QObject>(this, nullptr, &delayedRedirect, nullptr, nullptr, nullptr);
0
113}-
114-
115void QQuickParticleGroup::setSystem(QQuickParticleSystem* arg)-
116{-
117 if (m_system != arg) {
m_system != argDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickparticlegroup
FALSEnever evaluated
0-14
118 m_system = arg;-
119 m_system->registerParticleGroup(this);-
120 performDelayedRedirects();-
121 emit systemChanged(arg);-
122 }
executed 14 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickparticlegroup
14
123}
executed 14 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickparticlegroup
14
124-
125void QQuickParticleGroup::delayRedirect(QObject *obj)-
126{-
127 m_delayedRedirects << obj;-
128}
never executed: end of block
0
129-
130void QQuickParticleGroup::performDelayedRedirects()-
131{-
132 if (!m_system)
!m_systemDescription
TRUEnever evaluated
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickparticlegroup
0-14
133 return;
never executed: return;
0
134 foreach (QObject* obj, m_delayedRedirects)
_container_.controlDescription
TRUEnever evaluated
FALSEnever evaluated
_container_.controlDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickparticlegroup
FALSEnever evaluated
_container_.i != _container_.eDescription
TRUEnever evaluated
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickparticlegroup
0-14
135 m_system->stateRedirect(this, m_system, obj);
never executed: m_system->stateRedirect(this, m_system, obj);
0
136-
137 m_delayedRedirects.clear();-
138}
executed 14 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickparticlegroup
14
139-
140void QQuickParticleGroup::componentComplete(){-
141 if (!m_system && qobject_cast<QQuickParticleSystem*>(parent()))
!m_systemDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickparticlegroup
FALSEnever evaluated
qobject_cast<Q...em*>(parent())Description
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickparticlegroup
FALSEnever evaluated
0-14
142 setSystem(qobject_cast<QQuickParticleSystem*>(parent()));
executed 14 times by 2 tests: setSystem(qobject_cast<QQuickParticleSystem*>(parent()));
Executed by:
  • tst_examples
  • tst_qquickparticlegroup
14
143}
executed 14 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickparticlegroup
14
144-
145#include "moc_qquickparticlegroup_p.cpp"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0