// qDebug() << deltax << " " << deltay;
+ int oldx = x();
+ int oldy = y();
+
int newx = x() + deltax/15;
int newy = y() + deltay/15;
setX(qBound(sceneRectangle.left(),newx,sceneRectangle.right()-pixmap().width()));
setY(qBound(sceneRectangle.top(),newy,sceneRectangle.bottom()-pixmap().height()));
-}
+ //handle collisions and move back to the original position if false returned
-void OrientationControlledGraphicsPixmapObject::setBoundaries(QRectF boundaryrect)
-{
- boundaryrect_ = boundaryrect;
+ if (handleCollisions() == false)
+ {
+ setX(oldx);
+ setY(oldy);
+ }
}
+bool OrientationControlledGraphicsPixmapObject::handleCollisions()
+{
+ return true;
+}