Anthony
Anthony

Reputation: 8788

QGraphicsItem: overlapping bounding rectangles when drawing polygons

I'm trying to draw a hexagonal lattice in Qt, in which each hexagon needs to be clickable. I've subclassed QGraphicsItem and am drawing the lattice fine using a for loop. The problem is that because the bounding rectangles for adjacent hexagons overlap, half the time the wrong hexagon gets clicked.

Is there any way around this? Which QGraphicsItem, QGraphicsScene, or QGraphicsView method would I need to re-implement?

Upvotes: 1

Views: 983

Answers (1)

chalup
chalup

Reputation: 8516

QGraphicsItem::shape() (for both Qt 5 and Qt 6)

Upvotes: 4

Related Questions