summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/examples/collidingmice-example.qdoc4
-rw-r--r--examples/graphicsview/collidingmice/mouse.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp31
3 files changed, 31 insertions, 8 deletions
diff --git a/doc/src/examples/collidingmice-example.qdoc b/doc/src/examples/collidingmice-example.qdoc
index 5b124f9..f627fbf 100644
--- a/doc/src/examples/collidingmice-example.qdoc
+++ b/doc/src/examples/collidingmice-example.qdoc
@@ -95,11 +95,11 @@
the global qrand() function which is a thread-safe version of the
standard C++ rand() function.
- Then we call the \l {QGraphicsItem::rotate()}{rotate()} function
+ Then we call the \l {QGraphicsItem::setRotation()}{setRotation()} function
inherited from QGraphicsItem. Items live in their own local
coordinate system. Their coordinates are usually centered around
(0, 0), and this is also the center for all transformations. By
- calling the item's \l {QGraphicsItem::rotate()}{rotate()} function
+ calling the item's \l {QGraphicsItem::setRotation()}{setRotation()} function
we alter the direction in which the mouse will start moving.
When the QGraphicsScene decides to advance the scene a frame it will call
diff --git a/examples/graphicsview/collidingmice/mouse.cpp b/examples/graphicsview/collidingmice/mouse.cpp
index c6a67b1..4cc29dd 100644
--- a/examples/graphicsview/collidingmice/mouse.cpp
+++ b/examples/graphicsview/collidingmice/mouse.cpp
@@ -64,7 +64,7 @@ Mouse::Mouse()
: angle(0), speed(0), mouseEyeDirection(0),
color(qrand() % 256, qrand() % 256, qrand() % 256)
{
- rotate(qrand() % (360 * 16));
+ setRotation(qrand() % (360 * 16));
}
//! [0]
@@ -195,7 +195,7 @@ void Mouse::advance(int step)
qreal dx = ::sin(angle) * 10;
mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5;
- rotate(dx);
+ setRotation(rotation() + dx);
setPos(mapToParent(0, -(3 + sin(speed) * 3)));
}
//! [11]
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index eaf9896..a4eca4d 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -3535,7 +3535,13 @@ void QGraphicsItem::resetTransform()
/*!
\obsolete
- Use setRotation() instead
+ Use
+
+ \code
+ setRotation(rotation() + angle);
+ \endcode
+
+ instead.
Rotates the current item transformation \a angle degrees clockwise around
its origin. To translate around an arbitrary point (x, y), you need to
@@ -3555,7 +3561,13 @@ void QGraphicsItem::rotate(qreal angle)
/*!
\obsolete
- Use setScale() instead
+ Use
+
+ \code
+ setTransform(QTransform::fromScale(sx, sy), true);
+ \encode
+
+ instead.
Scales the current item transformation by (\a sx, \a sy) around its
origin. To scale from an arbitrary point (x, y), you need to combine
@@ -3575,7 +3587,13 @@ void QGraphicsItem::scale(qreal sx, qreal sy)
/*!
\obsolete
- Use setTransform() instead.
+ Use
+
+ \code
+ setTransform(QTransform().shear(sh, sv), true);
+ \endcode
+
+ instead.
Shears the current item transformation by (\a sh, \a sv).
@@ -3589,7 +3607,12 @@ void QGraphicsItem::shear(qreal sh, qreal sv)
/*!
\obsolete
- Use setPos() or setTransformOriginPoint() instead.
+ Use setPos() or setTransformOriginPoint() instead. For identical
+ behavior, use
+
+ \code
+ setTransform(QTransform::fromTranslate(dx, dy), true);
+ \endcode
Translates the current item transformation by (\a dx, \a dy).