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

后端 未结 3 1750
南方客
南方客 2021-01-18 14:39

Googling suggests that it should.

But the dragdroprobot example implementation (on the parent Robot object) suggests not:

QRectF Robot::boundingRect(         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-18 15:20

    Under normal usage the children of your QGraphicsItem are contained within its bounding rect, but depending on your implementation I don't believe that this is required.

    If you need the bounding rect of an item's children you can simply use

    QGraphicsItem::childrenBoundingRect();
    

提交回复
热议问题