[SOLVED]QGraphicsItem, QMatrix and children



  • Hi!

    I have QGraphicsTextItem nested in QGraphicsPolygonItem. Every time text is changed, I rescale parent using QMatrix class with setMatrix method.
    But then children ( text item in my case) also get resized and I'm back at square one.
    I haven't found anything useful in docs.
    The only solution that I've found is to loop through polygon points and move them by scale factor in desired direction.

    Is there any easier solution for this?



  • Maybe, it helpy to set the item flag QGraphicsItem::ItemIgnoresTransformations.
    It avoids a child item to react on parents transformation changes.



  • have you implement the method QGraphicsItem::itemChange () ?
    may be it will solve the problem ?



  • @pedro79
    Thanks. You solution works :) .

    @issam
    No I haven't.

    But due to ugly outcome of a scale ( if it's scaled by x twice and once by y, borders etc are extremly ugly as one is thicker than another etc...), I used my solution.

    Marked as solved.

    Regards,
    Jake


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.