I'm trying to rotate a QGraphicsItem about its own center, so that its center doesn't move, it just rotates X degrees...I can't get it to happen, it changes places, as if the whole scene rotates but the rest of the elements don't rotate ...but he rotates but not about his center. I leave the code to see if they give me a hand. Thanks a thousand.
QRectF rect;
rect = engine->boundingRect();
QPointF center = rect.center();
qreal angle = grade;
QTransform t;
t.translate(center.x(), center.y());
t.rotate(angle);
t.translate(-center.x(), -center.y());
engine->setPos(t.map(engine->pos()));
engine->setRotation(engine->rotation() + angle);
Engine is the QGraphicsItem that I want to rotate about its center...
Thanks to the note from @Trauma, I leave you here how I solved my problem in case it helps someone. All of the code in the question I simply replaced with the following: