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. QGraphicsItem - Bounding rect for item, and all children? [solved]
Forum Updated to NodeBB v4.3 + New Features

QGraphicsItem - Bounding rect for item, and all children? [solved]

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 5.6k 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.
  • L Offline
    L Offline
    LiamMaru
    wrote on last edited by
    #1

    Simple question: I can call boundingRect to get the bouding box of a given item. Is it possible to get the bounding box of an item, and all its children, without writing extra methods? is there some built in method? Thanks.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      [quote author="Qt Assistant" date="0"]QRectF QGraphicsItem::childrenBoundingRect () const

      Returns the bounding rect of this item's descendants (i.e., its children, their children, etc.) in local coordinates. The rectangle will contain all descendants after they have been mapped to local coordinates. If the item has no children, this function returns an empty QRectF.

      This does not include this item's own bounding rect; it only returns its descendants' accumulated bounding rect. If you need to include this item's bounding rect, you can add boundingRect() to childrenBoundingRect() using QRectF::operator|().

      This function is linear in complexity; it determines the size of the returned bounding rect by iterating through all descendants.[/quote]

      1 Reply Last reply
      0
      • L Offline
        L Offline
        LiamMaru
        wrote on last edited by
        #3

        Fantastic, thanks for the tip.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          You are welcome. Assistant contains a lot of info, you only need to find it. Please don't forget to mark thread as [solved] (by editing its title)

          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