Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.11
-
None
Description
The method
QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const
doesn't work always correctly using Qt::ItemSelectionMode mode = Qt::IntersectsItemShape.
If you have a parent QGraphicsItem with the QGraphicsItem::ItemClipsChildrenToShape set, the QGraphicsScene::items doesn't use the Qt::IntersectsItemShape for the children items, but use the bounding rect of the items.
Also the tooltip of the children items is shown when the mouse is over the bounding rect and not only over the shape.
I have investigate the Qt code and I see that this appens because the intersection method doesn't not call QGraphicsItem::shape() method for the children item, but the QGrapihcsItem::clipShape(), that use only the bounding rect of the item if the QGraphicsItem::ItemClipsToShape is not set.
A workaround is to set QGraphicsItem::ItemClipsToShape for all the children items, but I know that this can cause performance issues. This should not be necessary because my children items don't draw outside of their shape.