qgraphicstransform.cpp

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

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9