Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
6.2.4
-
None
Description
Consider the following code:
auto pen = QPen{{{ 93, 109, 194}}, 5}; pen.setCosmetic(true); auto c = new QGraphicsEllipseItem{{-0.2, -0.2, 0.4, 0.4}}; c->setPen(pen); auto boundingRect = c->boundingRect(); printf( "boundingRect = {.x = %lg, .y = %lg, .width = %lg, .height = %lg }\n", boundingRect.x(), boundingRect.y(), boundingRect.width(), boundingRect.height());
The output is
boundingRect = {.x = -2.7, .y = -2.7, .width = 5.4, .height = 5.4 }
i.e. 13.5 larger than the actual bounding rectangle. The culprit is QGraphicsEllipseItem::boundingRect, which assumes the pen width is in the scene units.