diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-06-25 19:44:44 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-26 04:18:14 +0200 |
commit | 62d4840011c3b5038402a4b043a7f7f85995b8f3 (patch) | |
tree | 54b8a7e2c182a0e4651f6fcdd25e3cfd2d1cf805 /examples | |
parent | a1f9149ac75f08877074d4898399b46943eb9cd2 (diff) |
Replace the QGraphicsItem deprecated transforming functions
The scale(), rotate() and translate() functions are replaced with
QGraphicsItem::setTransform.
Change-Id: Icb81c71b1513c049e2fd607995ca3a868108ee30
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Andreas Aardal Hanssen <andrhans@cisco.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/animation/animatedtiles/main.cpp | 2 | ||||
-rw-r--r-- | examples/dbus/remotecontrolledcar/car/car.cpp | 6 | ||||
-rw-r--r-- | examples/graphicsview/dragdroprobot/main.cpp | 2 | ||||
-rw-r--r-- | examples/graphicsview/weatheranchorlayout/main.cpp | 2 | ||||
-rw-r--r-- | examples/sql/drilldown/imageitem.cpp | 6 | ||||
-rw-r--r-- | examples/touch/knobs/knob.cpp | 2 | ||||
-rw-r--r-- | examples/touch/pinchzoom/mouse.cpp | 4 |
7 files changed, 12 insertions, 12 deletions
diff --git a/examples/animation/animatedtiles/main.cpp b/examples/animation/animatedtiles/main.cpp index 88e348333f..50bd33860e 100644 --- a/examples/animation/animatedtiles/main.cpp +++ b/examples/animation/animatedtiles/main.cpp @@ -164,7 +164,7 @@ int main(int argc, char **argv) centeredButton->setPos(100, 100); scene.addItem(buttonParent); - buttonParent->scale(0.75, 0.75); + buttonParent->setTransform(QTransform::fromScale(0.75, 0.75), true); buttonParent->setPos(200, 200); buttonParent->setZValue(65); diff --git a/examples/dbus/remotecontrolledcar/car/car.cpp b/examples/dbus/remotecontrolledcar/car/car.cpp index 4b771c2983..6776784f73 100644 --- a/examples/dbus/remotecontrolledcar/car/car.cpp +++ b/examples/dbus/remotecontrolledcar/car/car.cpp @@ -130,8 +130,8 @@ void Car::timerEvent(QTimerEvent *event) qreal turnRateRads = wheelsAngleRads / turnDistance; // rough estimate qreal turnRate = (turnRateRads * 180) / Pi; qreal rotation = speed * turnRate; - - rotate(rotation); - translate(0, -speed); + + setTransform(QTransform().rotate(rotation), true); + setTransform(QTransform::fromTranslate(0, -speed), true); update(); } diff --git a/examples/graphicsview/dragdroprobot/main.cpp b/examples/graphicsview/dragdroprobot/main.cpp index f12f6080c7..05d3c8f1b3 100644 --- a/examples/graphicsview/dragdroprobot/main.cpp +++ b/examples/graphicsview/dragdroprobot/main.cpp @@ -77,7 +77,7 @@ int main(int argc, char **argv) } Robot *robot = new Robot; - robot->scale(1.2, 1.2); + robot->setTransform(QTransform::fromScale(1.2, 1.2), true); robot->setPos(0, -20); scene.addItem(robot); //! [1] diff --git a/examples/graphicsview/weatheranchorlayout/main.cpp b/examples/graphicsview/weatheranchorlayout/main.cpp index fd91967cc3..64605bebc0 100644 --- a/examples/graphicsview/weatheranchorlayout/main.cpp +++ b/examples/graphicsview/weatheranchorlayout/main.cpp @@ -91,7 +91,7 @@ public: void setGeometry (const QRectF &rect) { - original->scale(rect.width() / r.width(), rect.height() / r.height()); + original->setTransform(QTransform::fromScale(rect.width() / r.width(), rect.height() / r.height()), true); original->setPos(rect.x(), rect.y()); r = rect; } diff --git a/examples/sql/drilldown/imageitem.cpp b/examples/sql/drilldown/imageitem.cpp index 2422ddd324..8173b2ae5f 100644 --- a/examples/sql/drilldown/imageitem.cpp +++ b/examples/sql/drilldown/imageitem.cpp @@ -91,9 +91,9 @@ void ImageItem::setFrame(int frame) adjust(); QPointF center = boundingRect().center(); - translate(center.x(), center.y()); - scale(1 + frame / 330.0, 1 + frame / 330.0); - translate(-center.x(), -center.y()); + setTransform(QTransform::fromTranslate(center.x(), center.y()), true); + setTransform(QTransform::fromScale(1 + frame / 330.0, 1 + frame / 330.0), true); + setTransform(QTransform::fromTranslate(-center.x(), -center.y()), true); } //! [3] diff --git a/examples/touch/knobs/knob.cpp b/examples/touch/knobs/knob.cpp index b3d07e7335..fbba7f2cbb 100644 --- a/examples/touch/knobs/knob.cpp +++ b/examples/touch/knobs/knob.cpp @@ -74,7 +74,7 @@ bool Knob::sceneEvent(QEvent *event) QLineF line1(touchPoint1.lastScenePos(), touchPoint2.lastScenePos()); QLineF line2(touchPoint1.scenePos(), touchPoint2.scenePos()); - rotate(line2.angleTo(line1)); + setTransform(QTransform().rotate(line2.angleTo(line1)), true); } break; diff --git a/examples/touch/pinchzoom/mouse.cpp b/examples/touch/pinchzoom/mouse.cpp index 1f5af2776e..a49b4aa85d 100644 --- a/examples/touch/pinchzoom/mouse.cpp +++ b/examples/touch/pinchzoom/mouse.cpp @@ -63,7 +63,7 @@ Mouse::Mouse() : angle(0), speed(0), mouseEyeDirection(0), color(qrand() % 256, qrand() % 256, qrand() % 256) { - rotate(qrand() % (360 * 16)); + setTransform(QTransform().rotate(qrand() % (360 * 16)), true); startTimer(1000 / 33); } //! [0] @@ -193,7 +193,7 @@ void Mouse::timerEvent(QTimerEvent *) qreal dx = ::sin(angle) * 10; mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5; - rotate(dx); + setTransform(QTransform().rotate(dx), true); setPos(mapToParent(0, -(3 + sin(speed) * 3))); } //! [11] |