QRectF MyItem::boundingRect() const { return QRectF(-10, -10, 20, 20); }
QRectF MyItem::boundingRect() const { return QRectF(pos().x() - 10, pos().y() - 10, 20, 20); }This code defines a bounding rectangle that is centered at the position of the QGraphicsItem object and has a size of 20 by 20. Package Library: QGraphicsItem is a part of the Qt GUI library.