Qt Forum

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

    Solved How to rotate an image 90 clockwise?

    General and Desktop
    3
    4
    1336
    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.
    • M
      MasterBlade last edited by

      I want to rotate a qpixmap 90 and place it at the same qlabel. What should I do?

      J.Hilk 1 Reply Last reply Reply Quote 0
      • J.Hilk
        J.Hilk Moderators @MasterBlade last edited by

        hi @MasterBlade
        to rotate a QPixmap, you have to call transform on it
        that will return a rotated Pixmap, the original is unchanged.

        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct

        Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply Reply Quote 5
        • KillerSmath
          KillerSmath last edited by

          @MasterBlade

          Use Transformed function

          QPixmap p1("URL");
          QPixmap p2 = p1.transformed(QTransform().rotate(90));
          
          label->setPixmap(p2);
          

          @Computer Science Student - Brazil
          Web Developer and Researcher
          “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

          1 Reply Last reply Reply Quote 6
          • M
            MasterBlade last edited by

            Thanks for the help!!!

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