My problem is the following: I have a QGraphicsScene, there is a QPixmap on it. I would like to rotate that pixmap around a center point, would work like a clock actually.
I've tried these:í
QPixmap pointer_pixmap("/home/peter/desktop/myimg2.png"); QTransform transform; QGraphicsPixmapItem *pointer = new QGraphicsPixmapItem(pointer_pixmap); pointer->setOffset(174,190); pointer->setTransformOriginPoint(QPoint(174-pointer_pixmap.width(), 190-pointer_pixmap.height())); transform.translate((174-pointer_pixmap.width())/2,(190-pointer_pixmap.height())/2); transform.rotate(60); transform.translate(-((174-pointer_pixmap.width())/2),-((190-pointer_pixmap.height())/2)); pointer_pixmap = pointer_pixmap.transformed(transform); item->addItem(pointer); pointer->setPixmap(pointer_pixmap);
It looks like the translation doesn't have any effect on my pixmap. Why's that?