Results 1 to 1 of 1

Thread: childrenBoundingRect doesn't update

  1. #1
    Join Date
    Mar 2010
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default childrenBoundingRect doesn't update

    Hello,

    I am attaching a code where I am trying to add 2 qgraphicsTextitem to its parent item which will be qgraphicsRectitem.
    then add Rectitem->scene->view which works fine.

    To set the qgraphicsRectitem size I use setRect(childrenBoundingRect())

    but if I query childrenBoundingRect() before adding any item or even after adding 1 item, then childrenBoundingRect() it will not update to new value.

    In program if I just (line number 24) print , recitem.childrenBoundingRect() then my qgrphicsrectitem will set the size to cover just "first text"

    but if I don't query or setRect as in line number 24 and 25 (if we comment both the line) then qgraphicsRectItem will set the size to cover both the text.

    In other words I should not query or setRect with childrenBoundingRect before adding all the children to parent. how to overcome this.

    Sorry If I am not clear, comment both the line 24 and 25 and then run the program, this is what I want.

    Thank you
    Attached Files Attached Files
    Last edited by sanku; 24th March 2011 at 11:02. Reason: incomplete

Similar Threads

  1. QGraphicsRectItem vs QGraphicsPolygonItem
    By Doru in forum Qt Programming
    Replies: 0
    Last Post: 26th January 2011, 07:12
  2. QGraphicsRectItem
    By c_srikanth1984 in forum Qt Programming
    Replies: 1
    Last Post: 29th July 2009, 09:04
  3. setRect vs boundingRect
    By zgulser in forum Qt Programming
    Replies: 5
    Last Post: 5th February 2009, 00:23
  4. How can I use QGraphicsRectItem?
    By learning_qt in forum Qt Programming
    Replies: 3
    Last Post: 14th January 2009, 10:00
  5. how to set setRect for proxy widget
    By wagmare in forum Qt Programming
    Replies: 0
    Last Post: 23rd November 2008, 13:46

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.