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
qgraphicstransform.h
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#ifndef QGRAPHICSTRANSFORM_H
5#define QGRAPHICSTRANSFORM_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtCore/QObject>
9#include <QtGui/QVector3D>
10#include <QtGui/QTransform>
11#include <QtGui/QMatrix4x4>
12
13QT_REQUIRE_CONFIG(graphicsview);
14
16
17class QGraphicsItem;
19
20class Q_WIDGETS_EXPORT QGraphicsTransform : public QObject
21{
23public:
24 QGraphicsTransform(QObject *parent = nullptr);
26
27 virtual void applyTo(QMatrix4x4 *matrix) const = 0;
28
29protected Q_SLOTS:
30 void update();
31
32protected:
34
35private:
36 friend class QGraphicsItem;
38 Q_DECLARE_PRIVATE(QGraphicsTransform)
39};
40
42
43class Q_WIDGETS_EXPORT QGraphicsScale : public QGraphicsTransform
44{
46
47 Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
48 Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY xScaleChanged)
49 Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY yScaleChanged)
50 Q_PROPERTY(qreal zScale READ zScale WRITE setZScale NOTIFY zScaleChanged)
51public:
52 QGraphicsScale(QObject *parent = nullptr);
54
55 QVector3D origin() const;
56 void setOrigin(const QVector3D &point);
57
58 qreal xScale() const;
59 void setXScale(qreal);
60
61 qreal yScale() const;
62 void setYScale(qreal);
63
64 qreal zScale() const;
65 void setZScale(qreal);
66
67 void applyTo(QMatrix4x4 *matrix) const override;
68
70 void originChanged();
71 void xScaleChanged();
72 void yScaleChanged();
73 void zScaleChanged();
74 void scaleChanged();
75
77 Q_DECLARE_PRIVATE(QGraphicsScale)
78};
79
81
82class Q_WIDGETS_EXPORT QGraphicsRotation : public QGraphicsTransform
83{
85
86 Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
87 Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
88 Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged)
89public:
90 QGraphicsRotation(QObject *parent = nullptr);
92
93 QVector3D origin() const;
94 void setOrigin(const QVector3D &point);
95
96 qreal angle() const;
97 void setAngle(qreal);
98
99 QVector3D axis() const;
100 void setAxis(const QVector3D &axis);
101 void setAxis(Qt::Axis axis);
102
103 void applyTo(QMatrix4x4 *matrix) const override;
104
106 void originChanged();
107 void angleChanged();
108 void axisChanged();
109
110private:
111 Q_DECLARE_PRIVATE(QGraphicsRotation)
112};
113
115
116#endif // QFXTRANSFORM_H
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
The QGraphicsRotation class provides a rotation transformation around a given axis.
The QGraphicsScale class provides a scale transformation.
The QGraphicsTransform class is an abstract base class for building advanced transformations on QGrap...
virtual void applyTo(QMatrix4x4 *matrix) const =0
This pure virtual method has to be reimplemented in derived classes.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtCore
Definition qobject.h:103
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
Combined button and popup list for selecting options.
Definition qcompare.h:63
GLfloat angle
GLuint GLenum matrix
GLfloat GLfloat p
[1]
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:187