Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Rotating a QLabel
sunil.nair last edited by
Hi, I have a QImage as QGraphicsItem in my QGraphicsView. I am resizing and rotating the image using setTransform.
QTransform rot; rot.translate(x,x); rot.rotate(45); rot.translate(-x,-x); graphicsItem->setTransform(rot);
Now I want to put a Qframe/Qlabel on top of this image which acts as a frame. I want the frame(widget) to rotate and resize with this QGraphicsItem. How can I do it?
why does it have to be a QWidget?
Easiest would be if you can use QGraphicsRectitem/QGraphicsTextItem and place it as a child of the image item. Then it will be also rotated along with the image item.
A Former User last edited by
You can add a widget to the scene using
QGraphicsProxyWidget *QGraphicsScene::addWidget(QWidget *widget, Qt::WindowFlags wFlags = Qt::WindowFlags()).