graphicsview/qgraphicstransform.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4void QGraphicsTransformPrivate::setItem(QGraphicsItem *i) -
5{ -
6 if (item == i)
partially evaluated: item == i
TRUEFALSE
yes
Evaluation Count:2890
no
Evaluation Count:0
0-2890
7 return;
executed: return;
Execution Count:2890
2890
8 -
9 if (item) {
never evaluated: item
0
10 QGraphicsTransform * const q = q_func(); -
11 QGraphicsItemPrivate *d_ptr = item->d_ptr.data(); -
12 -
13 item->prepareGeometryChange(); -
14 qt_noop(); -
15 d_ptr->transformData->graphicsTransforms.removeAll(q); -
16 d_ptr->dirtySceneTransform = 1; -
17 item = 0; -
18 }
never executed: }
0
19 -
20 item = i; -
21}
never executed: }
0
22 -
23void QGraphicsTransformPrivate::updateItem(QGraphicsItem *item) -
24{ -
25 item->prepareGeometryChange(); -
26 item->d_ptr->dirtySceneTransform = 1; -
27}
never executed: }
0
28 -
29 -
30 -
31 -
32QGraphicsTransform::QGraphicsTransform(QObject *parent) -
33 : QObject(*new QGraphicsTransformPrivate, parent) -
34{ -
35}
never executed: }
0
36 -
37 -
38 -
39 -
40QGraphicsTransform::~QGraphicsTransform() -
41{ -
42 QGraphicsTransformPrivate * const d = d_func(); -
43 d->setItem(0); -
44}
executed: }
Execution Count:2890
2890
45 -
46 -
47 -
48 -
49QGraphicsTransform::QGraphicsTransform(QGraphicsTransformPrivate &p, QObject *parent) -
50 : QObject(p, parent) -
51{ -
52}
executed: }
Execution Count:2890
2890
53void QGraphicsTransform::update() -
54{ -
55 QGraphicsTransformPrivate * const d = d_func(); -
56 if (d->item)
partially evaluated: d->item
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8670
0-8670
57 d->updateItem(d->item);
never executed: d->updateItem(d->item);
0
58}
executed: }
Execution Count:8670
8670
59class QGraphicsScalePrivate : public QGraphicsTransformPrivate -
60{ -
61public: -
62 QGraphicsScalePrivate() -
63 : xScale(1), yScale(1), zScale(1) {}
executed: }
Execution Count:1
1
64 QVector3D origin; -
65 qreal xScale; -
66 qreal yScale; -
67 qreal zScale; -
68}; -
69 -
70 -
71 -
72 -
73QGraphicsScale::QGraphicsScale(QObject *parent) -
74 : QGraphicsTransform(*new QGraphicsScalePrivate, parent) -
75{ -
76}
executed: }
Execution Count:1
1
77 -
78 -
79 -
80 -
81QGraphicsScale::~QGraphicsScale() -
82{ -
83} -
84QVector3D QGraphicsScale::origin() const -
85{ -
86 const QGraphicsScalePrivate * const d = d_func(); -
87 return d->origin;
executed: return d->origin;
Execution Count:4
4
88} -
89void QGraphicsScale::setOrigin(const QVector3D &point) -
90{ -
91 QGraphicsScalePrivate * const d = d_func(); -
92 if (d->origin == point)
partially evaluated: d->origin == point
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
93 return;
never executed: return;
0
94 d->origin = point; -
95 update(); -
96 originChanged(); -
97}
executed: }
Execution Count:4
4
98qreal QGraphicsScale::xScale() const -
99{ -
100 const QGraphicsScalePrivate * const d = d_func(); -
101 return d->xScale;
executed: return d->xScale;
Execution Count:4
4
102} -
103void QGraphicsScale::setXScale(qreal scale) -
104{ -
105 QGraphicsScalePrivate * const d = d_func(); -
106 if (d->xScale == scale)
partially evaluated: d->xScale == scale
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
107 return;
never executed: return;
0
108 d->xScale = scale; -
109 update(); -
110 xScaleChanged(); -
111 scaleChanged(); -
112}
executed: }
Execution Count:1
1
113qreal QGraphicsScale::yScale() const -
114{ -
115 const QGraphicsScalePrivate * const d = d_func(); -
116 return d->yScale;
executed: return d->yScale;
Execution Count:4
4
117} -
118void QGraphicsScale::setYScale(qreal scale) -
119{ -
120 QGraphicsScalePrivate * const d = d_func(); -
121 if (d->yScale == scale)
partially evaluated: d->yScale == scale
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
122 return;
never executed: return;
0
123 d->yScale = scale; -
124 update(); -
125 yScaleChanged(); -
126 scaleChanged(); -
127}
executed: }
Execution Count:1
1
128qreal QGraphicsScale::zScale() const -
129{ -
130 const QGraphicsScalePrivate * const d = d_func(); -
131 return d->zScale;
executed: return d->zScale;
Execution Count:4
4
132} -
133void QGraphicsScale::setZScale(qreal scale) -
134{ -
135 QGraphicsScalePrivate * const d = d_func(); -
136 if (d->zScale == scale)
partially evaluated: d->zScale == scale
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
137 return;
never executed: return;
0
138 d->zScale = scale; -
139 update(); -
140 zScaleChanged(); -
141 scaleChanged(); -
142}
executed: }
Execution Count:1
1
143 -
144 -
145 -
146 -
147void QGraphicsScale::applyTo(QMatrix4x4 *matrix) const -
148{ -
149 const QGraphicsScalePrivate * const d = d_func(); -
150 matrix->translate(d->origin); -
151 matrix->scale(d->xScale, d->yScale, d->zScale); -
152 matrix->translate(-d->origin); -
153}
executed: }
Execution Count:7
7
154class QGraphicsRotationPrivate : public QGraphicsTransformPrivate -
155{ -
156public: -
157 QGraphicsRotationPrivate() -
158 : angle(0), axis(0, 0, 1) {}
executed: }
Execution Count:2889
2889
159 QVector3D origin; -
160 qreal angle; -
161 QVector3D axis; -
162}; -
163 -
164 -
165 -
166 -
167QGraphicsRotation::QGraphicsRotation(QObject *parent) -
168 : QGraphicsTransform(*new QGraphicsRotationPrivate, parent) -
169{ -
170}
executed: }
Execution Count:2889
2889
171 -
172 -
173 -
174 -
175QGraphicsRotation::~QGraphicsRotation() -
176{ -
177} -
178QVector3D QGraphicsRotation::origin() const -
179{ -
180 const QGraphicsRotationPrivate * const d = d_func(); -
181 return d->origin;
executed: return d->origin;
Execution Count:3
3
182} -
183void QGraphicsRotation::setOrigin(const QVector3D &point) -
184{ -
185 QGraphicsRotationPrivate * const d = d_func(); -
186 if (d->origin == point)
partially evaluated: d->origin == point
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2170
0-2170
187 return;
never executed: return;
0
188 d->origin = point; -
189 update(); -
190 originChanged(); -
191}
executed: }
Execution Count:2170
2170
192qreal QGraphicsRotation::angle() const -
193{ -
194 const QGraphicsRotationPrivate * const d = d_func(); -
195 return d->angle;
executed: return d->angle;
Execution Count:3
3
196} -
197void QGraphicsRotation::setAngle(qreal angle) -
198{ -
199 QGraphicsRotationPrivate * const d = d_func(); -
200 if (d->angle == angle)
evaluated: d->angle == angle
TRUEFALSE
yes
Evaluation Count:1091
yes
Evaluation Count:2883
1091-2883
201 return;
executed: return;
Execution Count:1091
1091
202 d->angle = angle; -
203 update(); -
204 angleChanged(); -
205}
executed: }
Execution Count:2883
2883
206QVector3D QGraphicsRotation::axis() const -
207{ -
208 const QGraphicsRotationPrivate * const d = d_func(); -
209 return d->axis;
executed: return d->axis;
Execution Count:3
3
210} -
211void QGraphicsRotation::setAxis(const QVector3D &axis) -
212{ -
213 QGraphicsRotationPrivate * const d = d_func(); -
214 if (d->axis == axis)
evaluated: d->axis == axis
TRUEFALSE
yes
Evaluation Count:361
yes
Evaluation Count:3610
361-3610
215 return;
executed: return;
Execution Count:361
361
216 d->axis = axis; -
217 update(); -
218 axisChanged(); -
219}
executed: }
Execution Count:3610
3610
220void QGraphicsRotation::setAxis(Qt::Axis axis) -
221{ -
222 switch (axis) -
223 { -
224 case Qt::XAxis: -
225 setAxis(QVector3D(1, 0, 0)); -
226 break;
executed: break;
Execution Count:361
361
227 case Qt::YAxis: -
228 setAxis(QVector3D(0, 1, 0)); -
229 break;
executed: break;
Execution Count:361
361
230 case Qt::ZAxis: -
231 setAxis(QVector3D(0, 0, 1)); -
232 break;
executed: break;
Execution Count:361
361
233 } -
234}
executed: }
Execution Count:1083
1083
235 -
236 -
237 -
238 -
239void QGraphicsRotation::applyTo(QMatrix4x4 *matrix) const -
240{ -
241 const QGraphicsRotationPrivate * const d = d_func(); -
242 -
243 if (d->angle == 0. || d->axis.isNull() || qIsNaN(d->angle))
evaluated: d->angle == 0.
TRUEFALSE
yes
Evaluation Count:5806
yes
Evaluation Count:10084
evaluated: d->axis.isNull()
TRUEFALSE
yes
Evaluation Count:4320
yes
Evaluation Count:5764
evaluated: qIsNaN(d->angle)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5763
1-10084
244 return;
executed: return;
Execution Count:10127
10127
245 -
246 matrix->translate(d->origin); -
247 matrix->projectedRotate(d->angle, d->axis.x(), d->axis.y(), d->axis.z()); -
248 matrix->translate(-d->origin); -
249}
executed: }
Execution Count:5763
5763
250 -
251 -
252 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial