Results 1 to 5 of 5

Thread: Parent/child transformations

  1. #1
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Parent/child transformations

    Hi,

    when I transform a QGraphicsItem its childs inherit the transformation. Which flag or what can I do to skip that?

    I tried setting the parent to null before applying the transformation and setting it back later, but it's applied anyway.

    Please note I just want to ignore one specific transformation, so ItemIgnoresTransformations is not an option :S

    thanks!

  2. #2
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Parent/child transformations

    What kind of transformation are you talking about?
    Do you mean that if you rotate the parent, the child are rotated too?

    Since child item geometry is relative to its parent, it is quite so normal, isn't it?

    So, to fit your needs, dont use transormation built-in method and change only the shape of the parent with a method of your own.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Parent/child transformations

    I'd say in such case children of the item shouldn't really be children of the item. Or the transformation has to be done not on the level of the scene but actually "inside" the item code (affecting implementations of paint(), boundingRect() and shape()).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: Parent/child transformations

    Maybe I can try to transform it myself... I'll try later.

    thanks!

  5. #5
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: Parent/child transformations

    Solved.

    The item I was rotating was a QGraphicsPixmapItem, so I applied the transformation to its Pixmap. The item is not rotated, just the pixmap but that's what I wanted.

    Anyway, rotating the child 360 - angle of parent rotation should work fine.

Similar Threads

  1. parent/child callback
    By mhoover in forum General Programming
    Replies: 2
    Last Post: 24th June 2009, 23:50
  2. Transformations on QGraphicsItem
    By manojmka in forum Qt Programming
    Replies: 16
    Last Post: 5th December 2007, 13:20
  3. Having problems with transformations
    By maverick_pol in forum Qt Programming
    Replies: 1
    Last Post: 20th October 2007, 23:23
  4. QPen brush doesn't follow transformations
    By Mercurio in forum Qt Programming
    Replies: 2
    Last Post: 3rd July 2007, 08:38
  5. Brushes and window/viewport transformations
    By blukske in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2006, 13:59

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.