Rotating a QLabel

  • Hi, I have a QImage as QGraphicsItem in my QGraphicsView. I am resizing and rotating the image using setTransform.

    QTransform 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?

  • Moderators

    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.

  • You can add a widget to the scene using QGraphicsProxyWidget *QGraphicsScene::addWidget(QWidget *widget, Qt::WindowFlags wFlags = Qt::WindowFlags()).

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.