Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    Rotating a QLabel

    General and Desktop
    qimage qwidget rotation scale qgraphicsitem
    3
    3
    3478
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      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?

      raven-worx 1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators @sunil.nair last edited by

        @sunil.nair
        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.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply Reply Quote 0
        • ?
          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()).

          1 Reply Last reply Reply Quote 0
          • First post
            Last post