[Qt-interest] Howto Do `hit Test' with QGraphicsItems ?
Sean Harmer
sean.harmer at maps-technology.com
Wed May 5 13:05:18 CEST 2010
Hi,
On Wednesday 05 May 2010 11:47:53 Aaron Lewis wrote:
> Hi,
> I'm deploying a small game , which i need to set up some `edges'. I've
> learned the term hitTest from Flash , kinda of collision detections.
>
> e.g I have a wall around a map , and player should not get out of the
> yard , any move towards a wall is disallowed.
>
> So far what i tried is to take advantage of coordinate system.
> Rely on each items' pos() function with their image size , not so good
> anyway.
>
> Does anyone has any good ideas ?
>
> Appreciate any of your help ;-)
What you are looking for is QPainterPath QGraphicsItem::shape() const:
http://doc.qt.nokia.com/4.7-snapshot/qgraphicsitem.html#shape
Have fun!
Sean
More information about the Qt-interest-old
mailing list