OpenCoverage

qquickpointattractor_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquickpointattractor_p.h
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#ifndef ATTRACTORAFFECTOR_H-
41#define ATTRACTORAFFECTOR_H-
42-
43//-
44// W A R N I N G-
45// --------------
46//-
47// This file is not part of the Qt API. It exists purely as an-
48// implementation detail. This header file may change from version to-
49// version without notice, or even be removed.-
50//-
51// We mean it.-
52//-
53#include "qquickparticleaffector_p.h"-
54-
55QT_BEGIN_NAMESPACE-
56-
57class QQuickAttractorAffector : public QQuickParticleAffector-
58{-
59 Q_OBJECT-
60 Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged)-
61 Q_PROPERTY(qreal pointX READ pointX WRITE setPointX NOTIFY pointXChanged)-
62 Q_PROPERTY(qreal pointY READ pointY WRITE setPointY NOTIFY pointYChanged)-
63 Q_PROPERTY(AffectableParameters affectedParameter READ affectedParameter WRITE setAffectedParameter NOTIFY affectedParameterChanged)-
64 Q_PROPERTY(Proportion proportionalToDistance READ proportionalToDistance WRITE setProportionalToDistance NOTIFY proportionalToDistanceChanged)-
65-
66public:-
67 enum Proportion{-
68 Constant,-
69 Linear,-
70 Quadratic,-
71 InverseLinear,-
72 InverseQuadratic-
73 };-
74 Q_ENUM(Proportion)-
75-
76 enum AffectableParameters {-
77 Position,-
78 Velocity,-
79 Acceleration-
80 };-
81 Q_ENUM(AffectableParameters)-
82-
83 explicit QQuickAttractorAffector(QQuickItem *parent = 0);-
84-
85 qreal strength() const-
86 {-
87 return m_strength;
never executed: return m_strength;
0
88 }-
89-
90 qreal pointX() const-
91 {-
92 return m_x;
executed 4 times by 1 test: return m_x;
Executed by:
  • tst_examples
4
93 }-
94-
95 qreal pointY() const-
96 {-
97 return m_y;
executed 4 times by 1 test: return m_y;
Executed by:
  • tst_examples
4
98 }-
99-
100 AffectableParameters affectedParameter() const-
101 {-
102 return m_physics;
never executed: return m_physics;
0
103 }-
104-
105 Proportion proportionalToDistance() const-
106 {-
107 return m_proportionalToDistance;
never executed: return m_proportionalToDistance;
0
108 }-
109-
110Q_SIGNALS:-
111-
112 void strengthChanged(qreal arg);-
113-
114 void pointXChanged(qreal arg);-
115-
116 void pointYChanged(qreal arg);-
117-
118 void affectedParameterChanged(AffectableParameters arg);-
119-
120 void proportionalToDistanceChanged(Proportion arg);-
121-
122public Q_SLOTS:-
123void setStrength(qreal arg)-
124{-
125 if (m_strength != arg) {
m_strength != argDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpointattractor
FALSEnever evaluated
0-4
126 m_strength = arg;-
127 Q_EMIT strengthChanged(arg);-
128 }
executed 4 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpointattractor
4
129}
executed 4 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpointattractor
4
130-
131void setPointX(qreal arg)-
132{-
133 if (m_x != arg) {
m_x != argDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
FALSEnever evaluated
0-2
134 m_x = arg;-
135 Q_EMIT pointXChanged(arg);-
136 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_examples
2
137}
executed 2 times by 1 test: end of block
Executed by:
  • tst_examples
2
138-
139void setPointY(qreal arg)-
140{-
141 if (m_y != arg) {
m_y != argDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
FALSEnever evaluated
0-2
142 m_y = arg;-
143 Q_EMIT pointYChanged(arg);-
144 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_examples
2
145}
executed 2 times by 1 test: end of block
Executed by:
  • tst_examples
2
146void setAffectedParameter(AffectableParameters arg)-
147{-
148 if (m_physics != arg) {
m_physics != argDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpointattractor
FALSEnever evaluated
0-4
149 m_physics = arg;-
150 Q_EMIT affectedParameterChanged(arg);-
151 }
executed 4 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpointattractor
4
152}
executed 4 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpointattractor
4
153-
154void setProportionalToDistance(Proportion arg)-
155{-
156 if (m_proportionalToDistance != arg) {
m_proportional...istance != argDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpointattractor
FALSEnever evaluated
0-4
157 m_proportionalToDistance = arg;-
158 Q_EMIT proportionalToDistanceChanged(arg);-
159 }
executed 4 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpointattractor
4
160}
executed 4 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpointattractor
4
161-
162protected:-
163 bool affectParticle(QQuickParticleData *d, qreal dt) override;-
164-
165private:-
166qreal m_strength;-
167qreal m_x;-
168qreal m_y;-
169AffectableParameters m_physics;-
170Proportion m_proportionalToDistance;-
171};-
172-
173QT_END_NAMESPACE-
174#endif // ATTRACTORAFFECTOR_H-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0