Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquicktranslate.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qquicktranslate_p.h"
5#include "qquickitem_p.h"
6
8
10{
11public:
13 : x(0), y(0) {}
14
17};
18
19
57
66{
67 Q_D(const QQuickTranslate);
68 return d->x;
69}
70
72{
73 Q_D(QQuickTranslate);
74 if (d->x == x)
75 return;
76 d->x = x;
77 update();
78 emit xChanged();
79}
80
89{
90 Q_D(const QQuickTranslate);
91 return d->y;
92}
94{
95 Q_D(QQuickTranslate);
96 if (d->y == y)
97 return;
98 d->y = y;
99 update();
100 emit yChanged();
101}
102
104{
105 Q_D(const QQuickTranslate);
106 matrix->translate(d->x, d->y, 0);
107}
108
119
151
164{
165 Q_D(const QQuickScale);
166 return d->origin;
167}
169{
170 Q_D(QQuickScale);
171 if (d->origin == point)
172 return;
173 d->origin = point;
174 update();
176}
177
186{
187 Q_D(const QQuickScale);
188 return d->xScale;
189}
191{
192 Q_D(QQuickScale);
193 if (d->xScale == scale)
194 return;
195 d->xScale = scale;
196 update();
199}
200
209{
210 Q_D(const QQuickScale);
211 return d->yScale;
212}
214{
215 Q_D(QQuickScale);
216 if (d->yScale == scale)
217 return;
218 d->yScale = scale;
219 update();
222}
223
233{
234 Q_D(const QQuickScale);
235 return d->zScale;
236}
238{
239 Q_D(QQuickScale);
240 if (d->zScale == scale)
241 return;
242 d->zScale = scale;
243 update();
246}
247
249{
250 Q_D(const QQuickScale);
251 matrix->translate(d->origin);
252 matrix->scale(d->xScale, d->yScale, d->zScale);
253 matrix->translate(-d->origin);
254}
255
265
305
316{
317 Q_D(const QQuickRotation);
318 return d->origin;
319}
320
322{
323 Q_D(QQuickRotation);
324 if (d->origin == point)
325 return;
326 d->origin = point;
327 update();
329}
330
337{
338 Q_D(const QQuickRotation);
339 return d->angle;
340}
342{
343 Q_D(QQuickRotation);
344 if (d->angle == angle)
345 return;
346 d->angle = angle;
347 update();
349}
350
367{
368 Q_D(const QQuickRotation);
369 return d->axis;
370}
372{
373 Q_D(QQuickRotation);
374 if (d->axis == axis)
375 return;
376 d->axis = axis;
377 update();
379}
380
382{
383 switch (axis)
384 {
385 case Qt::XAxis:
386 setAxis(QVector3D(1, 0, 0));
387 break;
388 case Qt::YAxis:
389 setAxis(QVector3D(0, 1, 0));
390 break;
391 case Qt::ZAxis:
392 setAxis(QVector3D(0, 0, 1));
393 break;
394 }
395}
396
398{
399 Q_D(const QQuickRotation);
400
401 if (d->angle == 0. || d->axis.isNull())
402 return;
403
404 matrix->translate(d->origin);
405 matrix->projectedRotate(d->angle, d->axis.x(), d->axis.y(), d->axis.z());
406 matrix->translate(-d->origin);
407}
408
416
453
460{
461 Q_D(const QQuickMatrix4x4);
462 return d->matrix;
463}
464
466{
467 Q_D(QQuickMatrix4x4);
468 if (d->matrix == matrix)
469 return;
470 d->matrix = matrix;
471 update();
473}
474
476{
477 Q_D(const QQuickMatrix4x4);
478 *matrix *= d->matrix;
479}
480
482
483#include "moc_qquicktranslate_p.cpp"
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtCore
Definition qobject.h:103
QQuickMatrix4x4(QObject *parent=nullptr)
\qmltype Matrix4x4 \instantiates QQuickMatrix4x4 \inqmlmodule QtQuick
void setMatrix(const QMatrix4x4 &matrix)
void applyTo(QMatrix4x4 *matrix) const override
void matrixChanged()
void setAxis(const QVector3D &axis)
void setOrigin(const QVector3D &point)
void originChanged()
void axisChanged()
QQuickRotation(QObject *parent=nullptr)
\qmltype Rotation \instantiates QQuickRotation \inqmlmodule QtQuick
void applyTo(QMatrix4x4 *matrix) const override
void angleChanged()
void yScaleChanged()
void setYScale(qreal)
void applyTo(QMatrix4x4 *matrix) const override
void setOrigin(const QVector3D &point)
QQuickScale(QObject *parent=nullptr)
\qmltype Scale \instantiates QQuickScale \inqmlmodule QtQuick
void setXScale(qreal)
void scaleChanged()
void zScaleChanged()
void setZScale(qreal)
void xScaleChanged()
void originChanged()
void applyTo(QMatrix4x4 *matrix) const override
QQuickTranslate(QObject *parent=nullptr)
\qmltype Translate \instantiates QQuickTranslate \inqmlmodule QtQuick
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
Combined button and popup list for selecting options.
@ ZAxis
@ XAxis
@ YAxis
GLint GLint GLint GLint GLint x
[0]
GLfloat angle
GLint y
GLuint GLenum matrix
GLenum GLenum GLenum GLenum GLenum scale
#define emit
double qreal
Definition qtypes.h:187