summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativeflipable.cpp
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2010-03-25 06:08:15 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2010-03-25 06:42:06 (GMT)
commit9ace4e68eb0636284ecf73ed82e4518bbf0208be (patch)
tree2f62bcd7b0bad14910d9573c470c2bf25a43afe0 /src/declarative/graphicsitems/qdeclarativeflipable.cpp
parentf4c7b4f046669a4a3d6ed1e8d538e17648d27b4d (diff)
downloadQt-9ace4e68eb0636284ecf73ed82e4518bbf0208be.zip
Qt-9ace4e68eb0636284ecf73ed82e4518bbf0208be.tar.gz
Qt-9ace4e68eb0636284ecf73ed82e4518bbf0208be.tar.bz2
Port Flickable and Flipable to support QGraphicsObject.
Replacing QDeclarativeItem* members by QGraphicsObject*. Build fix too. Reviewed-by:akennedy
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeflipable.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
index 0e2ae63..cb4044f 100644
--- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
@@ -59,8 +59,8 @@ public:
void updateSceneTransformFromParent();
QDeclarativeFlipable::Side current;
- QDeclarativeGuard<QDeclarativeItem> front;
- QDeclarativeGuard<QDeclarativeItem> back;
+ QDeclarativeGuard<QGraphicsObject> front;
+ QDeclarativeGuard<QGraphicsObject> back;
};
/*!
@@ -112,13 +112,13 @@ QDeclarativeFlipable::~QDeclarativeFlipable()
The front and back sides of the flipable.
*/
-QDeclarativeItem *QDeclarativeFlipable::front()
+QGraphicsObject *QDeclarativeFlipable::front()
{
Q_D(const QDeclarativeFlipable);
return d->front;
}
-void QDeclarativeFlipable::setFront(QDeclarativeItem *front)
+void QDeclarativeFlipable::setFront(QGraphicsObject *front)
{
Q_D(QDeclarativeFlipable);
if (d->front) {
@@ -131,13 +131,13 @@ void QDeclarativeFlipable::setFront(QDeclarativeItem *front)
d->front->setOpacity(0.);
}
-QDeclarativeItem *QDeclarativeFlipable::back()
+QGraphicsObject *QDeclarativeFlipable::back()
{
Q_D(const QDeclarativeFlipable);
return d->back;
}
-void QDeclarativeFlipable::setBack(QDeclarativeItem *back)
+void QDeclarativeFlipable::setBack(QGraphicsObject *back)
{
Q_D(QDeclarativeFlipable);
if (d->back) {
@@ -195,12 +195,13 @@ void QDeclarativeFlipablePrivate::updateSceneTransformFromParent()
current = newSide;
if (current == QDeclarativeFlipable::Back && back) {
QTransform mat;
- mat.translate(back->width()/2,back->height()/2);
- if (back->width() && p1.x() >= p2.x())
+ QGraphicsItemPrivate *dBack = QGraphicsItemPrivate::get(back);
+ mat.translate(dBack->width()/2,dBack->height()/2);
+ if (dBack->width() && p1.x() >= p2.x())
mat.rotate(180, Qt::YAxis);
- if (back->height() && p2.y() >= p3.y())
+ if (dBack->height() && p2.y() >= p3.y())
mat.rotate(180, Qt::XAxis);
- mat.translate(-back->width()/2,-back->height()/2);
+ mat.translate(-dBack->width()/2,-dBack->height()/2);
back->setTransform(mat);
}
if (front)