Select inside polygon behaviour
Issue #23
resolved
(Reported by Thomas) Some polygons failed to select all blocks inside the polygon.
Comments (3)
-
reporter -
reporter QGraphicsScene.items() does not behave as expected when using Qt.ContainsItemShape mode, I tried re-implementing QGraphicsItem.shape(), but it didn't make a difference.
This was solved by using Qt.IntersectsItemShape with .items() and then narrow down to final list by using QGraphicsItem.collidesWithPath() with Qt.ContainsItemShape.
Also tried to remove text item as child of polygon... still the same.
-
reporter - changed status to resolved
Fix Issue
#23of not selecting all blocks inside polygon (behaving as selecting boundingRect() inside polygon).→ <<cset 9e6f6787dba0>>
- Log in to comment
It is noticed that it mostly happens with polygons with concave sections.
At the moment this is using Qt.ContainsItemShape, which "contains only items whose shape is fully contained inside the selection area". This is probably because by default Qt implement QGraphicsItem.shape() as simple bounding rectangle. This can be reimplemented to return a more accurate shape for non-rectangular items.
See:
http://qt-project.org/doc/qt-4.8/qt.html#ItemSelectionMode-enum
http://qt-project.org/doc/qt-4.8/qgraphicsitem.html#shape