File indexing completed on 2025-01-18 10:09:35
0001
0002
0003
0004 #ifndef QGRAPHICSTRANSFORM_H
0005 #define QGRAPHICSTRANSFORM_H
0006
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtCore/QObject>
0009 #include <QtGui/QVector3D>
0010 #include <QtGui/QTransform>
0011 #include <QtGui/QMatrix4x4>
0012
0013 QT_REQUIRE_CONFIG(graphicsview);
0014
0015 QT_BEGIN_NAMESPACE
0016
0017 class QGraphicsItem;
0018 class QGraphicsTransformPrivate;
0019
0020 class Q_WIDGETS_EXPORT QGraphicsTransform : public QObject
0021 {
0022 Q_OBJECT
0023 public:
0024 QGraphicsTransform(QObject *parent = nullptr);
0025 ~QGraphicsTransform();
0026
0027 virtual void applyTo(QMatrix4x4 *matrix) const = 0;
0028
0029 protected Q_SLOTS:
0030 void update();
0031
0032 protected:
0033 QGraphicsTransform(QGraphicsTransformPrivate &p, QObject *parent);
0034
0035 private:
0036 friend class QGraphicsItem;
0037 friend class QGraphicsItemPrivate;
0038 Q_DECLARE_PRIVATE(QGraphicsTransform)
0039 };
0040
0041 class QGraphicsScalePrivate;
0042
0043 class Q_WIDGETS_EXPORT QGraphicsScale : public QGraphicsTransform
0044 {
0045 Q_OBJECT
0046
0047 Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
0048 Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY xScaleChanged)
0049 Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY yScaleChanged)
0050 Q_PROPERTY(qreal zScale READ zScale WRITE setZScale NOTIFY zScaleChanged)
0051 public:
0052 QGraphicsScale(QObject *parent = nullptr);
0053 ~QGraphicsScale();
0054
0055 QVector3D origin() const;
0056 void setOrigin(const QVector3D &point);
0057
0058 qreal xScale() const;
0059 void setXScale(qreal);
0060
0061 qreal yScale() const;
0062 void setYScale(qreal);
0063
0064 qreal zScale() const;
0065 void setZScale(qreal);
0066
0067 void applyTo(QMatrix4x4 *matrix) const override;
0068
0069 Q_SIGNALS:
0070 void originChanged();
0071 void xScaleChanged();
0072 void yScaleChanged();
0073 void zScaleChanged();
0074 void scaleChanged();
0075
0076 private:
0077 Q_DECLARE_PRIVATE(QGraphicsScale)
0078 };
0079
0080 class QGraphicsRotationPrivate;
0081
0082 class Q_WIDGETS_EXPORT QGraphicsRotation : public QGraphicsTransform
0083 {
0084 Q_OBJECT
0085
0086 Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
0087 Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
0088 Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged)
0089 public:
0090 QGraphicsRotation(QObject *parent = nullptr);
0091 ~QGraphicsRotation();
0092
0093 QVector3D origin() const;
0094 void setOrigin(const QVector3D &point);
0095
0096 qreal angle() const;
0097 void setAngle(qreal);
0098
0099 QVector3D axis() const;
0100 void setAxis(const QVector3D &axis);
0101 void setAxis(Qt::Axis axis);
0102
0103 void applyTo(QMatrix4x4 *matrix) const override;
0104
0105 Q_SIGNALS:
0106 void originChanged();
0107 void angleChanged();
0108 void axisChanged();
0109
0110 private:
0111 Q_DECLARE_PRIVATE(QGraphicsRotation)
0112 };
0113
0114 QT_END_NAMESPACE
0115
0116 #endif