tags:

views:

70

answers:

2

I am trying to create a chessboard. All the coins are transparent and the board is not. When I tried to get the clicked item using the function 'itemAt' it always returning the backGround item(that means the board). I am suspecting that due to the fact that the coins are transparent, they are not selected.

A: 

If you are using your own custom QGraphicsItem then you may need to override shape(),

If it's a plain QGraphicsPixmapItem and it has an alpha mask, then you need to call setShapeMode().

Stephen Chu
A: 

I got the answer. I tried to get the event->pos(). This will return the mouse click in the QGraphicsItem's coordinates. So I should use event->scenePos(). Now I am geting it properly

prabhakaran