Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-38953

childrenRect doesn't take transformations into account.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.2.1
    • None

      Consider the following QML fragment:

      Rectangle
      {
          color: "green"
      
          width: childrenRect.width
          height: childrenRect.height
      
          x: 100
          y: 100
      
          Rectangle
          {
              id: test
              color: "red"
              width: 100
              height: 50
              rotation: 45
          }
      }
      

      The expected behavior is that the green rectangle encompasses the bounds of the red rectangle. The actual behavior is that the green rectangle reflects the untransformed dimensions of the red rectangle. See the attachment for more info.

      This is the simplest case I can show, but the problem exists with arbitrary hierarchies based on childrenRect. I'm working on a workaround to compute the bounds of an arbitrary child hierarchy now but I'd expect childrenRect to represent the 2D bounding box of all children regardless of transformations.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            srutledg Shawn Rutledge
            snichols Stephen Nichols
            Votes:
            11 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes