Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QTransform Class Reference

List of all members.


Detailed Description

The QTransform class specifies 2D transformations of a coordinate system.

Since:
4.3
A transformation specifies how to translate, scale, shear, rotate or project the coordinate system, and is typically used when rendering graphics.

QTransform differs from QMatrix in that it is a true 3x3 matrix, allowing perspective transformations. QTransform's toAffine() method allows casting QTransform to QMatrix. If a perspective transformation has been specified on the matrix, then the conversion to an affine QMatrix will cause loss of data.

QTransform is the recommended transformation class in Qt.

A QTransform object can be built using the setMatrix(), scale(), rotate(), translate() and shear() functions. Alternatively, it can be built by applying {QTransform::Basic Matrix Operations}{basic matrix operations}. The matrix can also be defined when constructed, and it can be reset to the identity matrix (the default) using the reset() function.

The QTransform class supports mapping of graphic primitives: A given point, line, polygon, region, or painter path can be mapped to the coordinate system defined by this matrix using the map() function. In case of a rectangle, its coordinates can be transformed using the mapRect() function. A rectangle can also be transformed into a polygon (mapped to the coordinate system defined by this matrix), using the mapToPolygon() function.

QTransform provides the isIdentity() function which returns true if the matrix is the identity matrix, and the isInvertible() function which returns true if the matrix is non-singular (i.e. AB = BA = I). The inverted() function returns an inverted copy of this matrix if it is invertible (otherwise it returns the identity matrix). In addition, QTransform provides the det() function returning the matrix's determinant.

Finally, the QTransform class supports matrix multiplication, and objects of the class can be streamed as well as compared.

Definition at line 56 of file qtransform.h.


Public Types

enum  TransformationType {
  TxNone = 0x00, TxTranslate = 0x01, TxScale = 0x02, TxRotate = 0x04,
  TxShear = 0x08, TxProject = 0x10
}

Public Member Functions

QTransform adjoint () const
qreal det () const
qreal determinant () const
qreal dx () const
qreal dy () const
QTransform inverted (bool *invertible=0) const
bool isAffine () const
bool isIdentity () const
bool isInvertible () const
bool isRotating () const
bool isScaling () const
bool isTranslating () const
qreal m11 () const
qreal m12 () const
qreal m13 () const
qreal m21 () const
qreal m22 () const
qreal m23 () const
qreal m31 () const
qreal m32 () const
qreal m33 () const
void map (qreal x, qreal y, qreal *tx, qreal *ty) const
void map (int x, int y, int *tx, int *ty) const
QPainterPath map (const QPainterPath &p) const
QRegion map (const QRegion &r) const
QPolygon map (const QPolygon &a) const
QPolygonF map (const QPolygonF &a) const
QLineF map (const QLineF &l) const
QLine map (const QLine &l) const
QPointF map (const QPointF &p) const
QPoint map (const QPoint &p) const
QRectF mapRect (const QRectF &) const
QRect mapRect (const QRect &) const
QPolygon mapToPolygon (const QRect &r) const
 operator QVariant () const
bool operator!= (const QTransform &) const
QTransform operator* (const QTransform &o) const
QTransformoperator*= (qreal div)
QTransformoperator*= (const QTransform &)
QTransformoperator+= (qreal div)
QTransformoperator-= (qreal div)
QTransformoperator/= (qreal div)
QTransformoperator= (const QTransform &)
bool operator== (const QTransform &) const
 QTransform (const QMatrix &mtx)
 QTransform (qreal h11, qreal h12, qreal h21, qreal h22, qreal dx, qreal dy)
 QTransform (qreal h11, qreal h12, qreal h13, qreal h21, qreal h22, qreal h23, qreal h31, qreal h32, qreal h33=1.0)
 QTransform ()
void reset ()
QTransformrotate (qreal a, Qt::Axis axis=Qt::ZAxis)
QTransformrotateRadians (qreal a, Qt::Axis axis=Qt::ZAxis)
QTransformscale (qreal sx, qreal sy)
void setMatrix (qreal m11, qreal m12, qreal m13, qreal m21, qreal m22, qreal m23, qreal m31, qreal m32, qreal m33)
QTransformshear (qreal sh, qreal sv)
const QMatrixtoAffine () const
QTransformtranslate (qreal dx, qreal dy)
QTransform transposed () const
TransformationType type () const

Static Public Member Functions

static QTransform fromScale (qreal dx, qreal dy)
static QTransform fromTranslate (qreal dx, qreal dy)
static bool quadToQuad (const QPolygonF &one, const QPolygonF &two, QTransform &result)
static bool quadToSquare (const QPolygonF &quad, QTransform &result)
static bool squareToQuad (const QPolygonF &square, QTransform &result)

Private Attributes

QMatrix affine
Private * d
qreal m_13
qreal m_23
qreal m_33
uint m_dirty: 5
uint m_type: 5

Related Functions

(Note that these are not member functions.)

QPainterPath operator* (const QPainterPath &path, const QTransform &matrix)
QRegion operator* (const QRegion &region, const QTransform &matrix)
QPolygon operator* (const QPolygon &polygon, const QTransform &matrix)
QPolygonF operator* (const QPolygonF &polygon, const QTransform &matrix)
QLine operator* (const QLine &line, const QTransform &matrix)
QLineF operator* (const QLineF &line, const QTransform &matrix)
QPointF operator* (const QPointF &point, const QTransform &matrix)
QPoint operator* (const QPoint &point, const QTransform &matrix)
QDataStreamoperator<< (QDataStream &stream, const QTransform &matrix)
QDataStreamoperator>> (QDataStream &stream, QTransform &matrix)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index