Results 1 to 3 of 3

Thread: QTransform rotate and scale order

  1. #1
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Question QTransform rotate and scale order

    Hi,

    I have an application that applies transformations to QGraphicsPolygonItems.

    The working code is:
    Qt Code:
    1. QTransform trans;
    2. trans = trans.rotate(formerRotation);
    3. trans = trans.scale(currentXFactor,currentYFactor);
    4. setTransform(trans,false); //Replaces the tranformation
    To copy to clipboard, switch view to plain text mode 

    However if I first scale and then rotate the result is completely different as rotating and then scaling.

    Any idea why?

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QTransform rotate and scale order

    Because the transformations are applied one at a time, in the order given, and the order in which transformations are applied makes a difference.

  3. #3
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTransform rotate and scale order

    Cool, Thanks.

Similar Threads

  1. Using QTransform to map the mouse
    By Cruz in forum Qt Programming
    Replies: 0
    Last Post: 22nd February 2010, 08:47
  2. QTransform()
    By mkind in forum Newbie
    Replies: 0
    Last Post: 19th February 2010, 21:45
  3. GraphicsItemChange and QTransform
    By ct-xuyaojun in forum Qt Programming
    Replies: 0
    Last Post: 28th September 2009, 09:16
  4. QTransform vs QMatrix
    By maverick_pol in forum Qt Programming
    Replies: 7
    Last Post: 4th October 2007, 10:53
  5. Can QPicture scale and rotate ?
    By igor in forum Qt Programming
    Replies: 6
    Last Post: 25th January 2007, 22:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.