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. [SOLVED]QGraphicsItem, QMatrix and children
Qt 6.11 is out! See what's new in the release blog

[SOLVED]QGraphicsItem, QMatrix and children

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.8k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    Jake007
    wrote on last edited by
    #1

    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?


    Code is poetry

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pedro79
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • I Offline
        I Offline
        issam
        wrote on last edited by
        #3

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

        http://www.iissam.com/

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jake007
          wrote on last edited by
          #4

          @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


          Code is poetry

          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