Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
4.7.4, 5.12.1, 5.12.2, 5.13.2, 5.14.0
-
None
Description
Hello,
There is a bug (at least since Qt 4.7.4 where I first seen it, and then tested on Qt 5.12.1 where it is still present) while calling QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemSelectionMode mode) with mode = Qt::ContainsItemShape, indeed, it seems it is not actually working on item shape but on bounding box instead.
In the project I attached, we can clearly see that green and red shapes are fully inside the blue one, but only green is found when calling QGraphicsScene::items function (see output qDebug after application run), and, what make me think that it works on bounding box instead is that green shape (that is detected) has actually its bounding box fully inside blue shape but the red one (that is not detected) has its shape but not its bounding box inside the blue shape, also, in Widget.cpp in attached project, if you define BUG_BEHAVIOUR to 0 instead of 1, the red shape will be moved so that its bounding box is also inside the blue one and then will now actually be detected inside.
Also, I tried several other "collidingItems" functions but they are not working at all (always finding no item), you can see all in Widget::GetCollidings function.
Thanks for looking at this.