Qt Forum

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

    QTransform.rotate() from the middle point?

    General and Desktop
    2
    3
    4728
    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.
    • I
      itsmemax last edited by

      Hello. I want my QTransform rotating from the middle point of my QLine (so, if my QLine is 50 pixels long, it should rotate from X 25 for example)! At the moment it rotates from the left point, so from X 0. How to do this?

      1 Reply Last reply Reply Quote 0
      • P
        PeerS last edited by

        I guess you have to translate the line so that its middle point lays on the rotation axis. Then you can rotate around this axis and afterwards you can translate your line back using the inverse of your previous translation.

        Beware that translating an object and then rotating it gives a different result as first rotating it and then translating it even if the translation distance and the rotation angle is the same: This kind of coordinate transformations are not commutative.

        1 Reply Last reply Reply Quote 0
        • I
          itsmemax last edited by

          Yup! I had to translate. But I solved it myself already. Thanks anyways!

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