Search code examples
pysideqgraphicsitem

Selecting QGraphicsPathItem incorrect


Why does there appear to be a selection issue regarding QGraphicsPAthItem's that are bezier paths? In the image below you can see my cursor is no where close to the line but it shows as being in a hover state turn the line White.

The more curvy the line, the more inaccurate the hover/selecting is. How can i fix this? The red X indicates the location of my cursor.

enter image description here


Solution

  • https://stackoverflow.com/a/32435391/3156300

    qp = QPainterPathStroker()
    qp.setWidth(12)
    qp.setCapStyle(Qt.SquareCap)
    return qp.createStroke(self.path())