Should QGraphicsItem :: boundingRect () include child bounding rectangles?

Googling suggests that he should .

But the dragdroprobot implementation (on the parent Robot) does not imply:

QRectF Robot::boundingRect() const
{
    return QRectF();
}

What is right, or is there something more subtle?

+5
source share
3 answers

Baby items are painted directly by the scene not by the parent, but in accordance with the documentation aboutboundingRect() :

QGraphicsView uses this to determine if an item needs to be redrawn.

, , , . - , .

+6

QGraphicsItem , , .

,

QGraphicsItem::childrenBoundingRect();
+2

, :

  • QGraphicItemGroup .

:

boundingRect() QGraphicsItemGroup .

( , boundingRect , QGraphicsItemGroup QGraphicsItem. , .)

  1. QGraphicItem.shape() boundingRect() , ( , .. QGraphicsView.items(), , boundingRect() , ).

, QGraphicItemGroup.shape() QGraphicsView.items(). , .

+1

All Articles