Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTransform.rotate() from the middle point?

QTransform.rotate() from the middle point?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.9k Views
  • 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 Offline
    I Offline
    itsmemax
    wrote on last edited by
    #1

    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
    0
    • P Offline
      P Offline
      PeerS
      wrote on last edited by
      #2

      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
      0
      • I Offline
        I Offline
        itsmemax
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved