From 99ecf471075088eba042575772196e63cab5b8f8 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sun, 26 Jul 2009 00:43:12 +0200 Subject: Doc: Replace QMatrix with QTransform and respective functions in various places. --- doc/src/coordsys.qdoc | 18 +++++++++--------- doc/src/examples/transformations.qdoc | 6 +++--- doc/src/graphicsview.qdoc | 10 +++------- src/gui/graphicsview/qgraphicsscene.cpp | 2 +- src/gui/graphicsview/qgraphicsview.cpp | 20 +++++++++++--------- src/gui/painting/qmatrix.cpp | 7 +++++-- src/gui/painting/qpainter.cpp | 2 +- 7 files changed, 33 insertions(+), 32 deletions(-) diff --git a/doc/src/coordsys.qdoc b/doc/src/coordsys.qdoc index 7ba3946..4a73d67 100644 --- a/doc/src/coordsys.qdoc +++ b/doc/src/coordsys.qdoc @@ -224,12 +224,12 @@ Transformations} demo for a visualization of a sheared coordinate system. All the transformation operations operate on QPainter's transformation matrix that you can retrieve using the - QPainter::worldMatrix() function. A matrix transforms a point in the - plane to another point. + QPainter::worldTransform() function. A matrix transforms a point + in the plane to another point. If you need the same transformations over and over, you can also - use QMatrix objects and the QPainter::worldMatrix() and - QPainter::setWorldMatrix() functions. You can at any time save the + use QTransform objects and the QPainter::worldTransform() and + QPainter::setWorldTransform() functions. You can at any time save the QPainter's transformation matrix by calling the QPainter::save() function which saves the matrix on an internal stack. The QPainter::restore() function pops it back. @@ -318,7 +318,7 @@ transformations affects the result. For more information about the transformation matrix, see the - QMatrix documentation. + QTransform documentation. \section1 Window-Viewport Conversion @@ -328,7 +328,7 @@ The mapping of the logical coordinates to the physical coordinates are handled by QPainter's world transformation \l - {QPainter::worldMatrix()}{worldMatrix()} (described in the \l + {QPainter::worldTransform()}{worldTransform()} (described in the \l Transformations section), and QPainter's \l {QPainter::viewport()}{viewport()} and \l {QPainter::window()}{window()}. The viewport represents the @@ -419,14 +419,14 @@ \endtable The 2D transformations of the coordinate system are specified - using the QMatrix class: + using the QTransform class: \table \header \o Class \o Description \row - \o QMatrix + \o QTransform \o - A 3 x 3 transformation matrix. Use QMatrix to rotate, shear, + A 3 x 3 transformation matrix. Use QTransform to rotate, shear, scale, or translate the coordinate system. \endtable diff --git a/doc/src/examples/transformations.qdoc b/doc/src/examples/transformations.qdoc index a449d4c..a5f92a8 100644 --- a/doc/src/examples/transformations.qdoc +++ b/doc/src/examples/transformations.qdoc @@ -85,10 +85,10 @@ All the tranformation operations operate on QPainter's tranformation matrix that you can retrieve using the - QPainter::matrix() function. A matrix transforms a point in the + QPainter::worldTransform() function. A matrix transforms a point in the plane to another point. For more information about the transformation matrix, see the \l {The Coordinate System} and - QMatrix documentation. + QTransform documentation. \snippet examples/painting/transformations/renderarea.h 0 @@ -375,7 +375,7 @@ All the tranformation operations operate on QPainter's tranformation matrix. For more information about the transformation matrix, see the \l {The Coordinate System} and - QMatrix documentation. + QTransform documentation. The Qt reference documentation provides several painting demos. Among these is the \l {demos/affine}{Affine diff --git a/doc/src/graphicsview.qdoc b/doc/src/graphicsview.qdoc index f42c0d4..89f9f3d 100644 --- a/doc/src/graphicsview.qdoc +++ b/doc/src/graphicsview.qdoc @@ -141,7 +141,7 @@ to scene coordinates where appropriate), before sending the events to the visualized scene. - Using its transformation matrix, QGraphicsView::matrix(), the view can + Using its transformation matrix, QGraphicsView::transform(), the view can \e transform the scene's coordinate system. This allows advanced navigation features such as zooming and rotation. For convenience, QGraphicsView also provides functions for translating between view and @@ -174,7 +174,7 @@ also provides many functions for mapping coordinates between the item and the scene, and from item to item. Also, like QGraphicsView, it can transform its coordinate system using a matrix: - QGraphicsItem::matrix(). This is useful for rotating and scaling + QGraphicsItem::transform(). This is useful for rotating and scaling individual items. Items can contain other items (children). Parent items' @@ -461,11 +461,7 @@ By making an item a child of another, you can achieve the most essential feature of item grouping: the items will move together, and - all transformations are propagated from parent to child. QGraphicsItem - can also handle all events for its children (see - QGraphicsItem::setHandlesChildEvents()). This allows the parent item - to act on behalf of its children, effectively treating all items as - one. + all transformations are propagated from parent to child. In addition, QGraphicsItemGroup is a special item that combines child event handling with a useful interface for adding and removing items diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 9b6414d..0dce26b 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4697,7 +4697,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool background has been drawn, and before the foreground has been drawn. All painting is done in \e scene coordinates. Before drawing each item, the painter must be transformed using - QGraphicsItem::sceneMatrix(). + QGraphicsItem::sceneTransform(). The \a options parameter is the list of style option objects for each item in \a items. The \a numItems parameter is the number of diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 53b044c..ca55f2e 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -97,8 +97,8 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < setViewport(new QGLWidget). QGraphicsView takes ownership of the viewport widget. - QGraphicsView supports affine transformations, using QMatrix. You can - either pass a matrix to setMatrix(), or you can call one of the + QGraphicsView supports affine transformations, using QTransform. You can + either pass a matrix to setTransform(), or you can call one of the convenience functions rotate(), scale(), translate() or shear(). The most two common transformations are scaling, which is used to implement zooming, and rotation. QGraphicsView keeps the center of the view fixed @@ -1583,7 +1583,7 @@ void QGraphicsView::setSceneRect(const QRectF &rect) Returns the current transformation matrix for the view. If no current transformation is set, the identity matrix is returned. - \sa setMatrix(), rotate(), scale(), shear(), translate() + \sa setMatrix(), transform(), rotate(), scale(), shear(), translate() */ QMatrix QGraphicsView::matrix() const { @@ -1615,7 +1615,7 @@ QMatrix QGraphicsView::matrix() const a view coordinate to a floating point scene coordinate, or mapFromScene() to map from floating point scene coordinates to view coordinates. - \sa matrix(), rotate(), scale(), shear(), translate() + \sa matrix(), setTransform(), rotate(), scale(), shear(), translate() */ void QGraphicsView::setMatrix(const QMatrix &matrix, bool combine) { @@ -1624,6 +1624,8 @@ void QGraphicsView::setMatrix(const QMatrix &matrix, bool combine) /*! Resets the view transformation matrix to the identity matrix. + + \sa resetTransform() */ void QGraphicsView::resetMatrix() { @@ -1633,7 +1635,7 @@ void QGraphicsView::resetMatrix() /*! Rotates the current view transformation \a angle degrees clockwise. - \sa setMatrix(), matrix(), scale(), shear(), translate() + \sa setTransform(), transform(), scale(), shear(), translate() */ void QGraphicsView::rotate(qreal angle) { @@ -1646,7 +1648,7 @@ void QGraphicsView::rotate(qreal angle) /*! Scales the current view transformation by (\a sx, \a sy). - \sa setMatrix(), matrix(), rotate(), shear(), translate() + \sa setTransform(), transform(), rotate(), shear(), translate() */ void QGraphicsView::scale(qreal sx, qreal sy) { @@ -1659,7 +1661,7 @@ void QGraphicsView::scale(qreal sx, qreal sy) /*! Shears the current view transformation by (\a sh, \a sv). - \sa setMatrix(), matrix(), rotate(), scale(), translate() + \sa setTransform(), transform(), rotate(), scale(), translate() */ void QGraphicsView::shear(qreal sh, qreal sv) { @@ -1672,7 +1674,7 @@ void QGraphicsView::shear(qreal sh, qreal sv) /*! Translates the current view transformation by (\a dx, \a dy). - \sa setMatrix(), matrix(), rotate(), shear() + \sa setTransform(), transform(), rotate(), shear() */ void QGraphicsView::translate(qreal dx, qreal dy) { @@ -1830,7 +1832,7 @@ void QGraphicsView::ensureVisible(const QGraphicsItem *item, int xmargin, int ym If \a rect is empty, or if the viewport is too small, this function will do nothing. - \sa setMatrix(), ensureVisible(), centerOn() + \sa setTransform(), ensureVisible(), centerOn() */ void QGraphicsView::fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRatioMode) { diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp index 221267f..bc08235 100644 --- a/src/gui/painting/qmatrix.cpp +++ b/src/gui/painting/qmatrix.cpp @@ -60,6 +60,9 @@ QT_BEGIN_NAMESPACE A matrix specifies how to translate, scale, shear or rotate the coordinate system, and is typically used when rendering graphics. + QMatrix, in contrast to QTransform, does not allow perspective + transformations. QTransform is the recommended transformation + class in Qt. A QMatrix object can be built using the setMatrix(), scale(), rotate(), translate() and shear() functions. Alternatively, it @@ -172,8 +175,8 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/matrix/matrix.cpp 2 \endtable - \sa QPainter, {The Coordinate System}, {demos/affine}{Affine - Transformations Demo}, {Transformations Example} + \sa QPainter, QTransform, {The Coordinate System}, + {demos/affine}{Affine Transformations Demo}, {Transformations Example} */ diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 0460071..4c10a5a 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1016,7 +1016,7 @@ void QPainterPrivate::updateState(QPainterState *newState) \o layoutDirection() defines the layout direction used by the painter when drawing text. - \o matrixEnabled() tells whether world transformation is enabled. + \o worldMatrixEnabled() tells whether world transformation is enabled. \o viewTransformEnabled() tells whether view transformation is enabled. -- cgit v0.12