Let's say I have a QGrahicsRectItem item with item.width=10 and item.height=10. Its top left corner is at (0,0). item.BoundingRect()
should return a RectF(0,0,9,9)
but instead it returns a RectF(0,0,10,10)
You can test it with the following code:
QGraphicsRectItem* item = new QGraphicsRectItem(0,0,10,10);
qDebug() << item->boundingRect().width(); // 10, OK
qDebug() << item->boundingRect().height(); // 10, OK
qDebug() << item->boundingRect().topLeft().x(); // 0, OK
qDebug() << item->boundingRect().topLeft().y(); // 0, OK
qDebug() << item->boundingRect().bottomRight().x(); // 10, WHY? should be 9
qDebug() << item->boundingRect().bottomRight().y(); // 10, WHY? should be 9
So boundingRect() returns a RectF that has a width and height of 11px, although width() and height() claim it's 10 for both.
What's wrong?