PDA

View Full Version : Using QGraphicsScene::itemAt, ignoring certain types of QGraphicsItems



blooglet
15th April 2011, 20:34
I have two types of QGraphicsItems in my graphics scene: GraphicNodes (with rectangle-, ellipse- and diamond-shaped implementations) and GraphicArcs (arrows that currently lack an arrow head). When I use QGraphicsScene::itemAt to get the topmost object at a certain position, I want the GraphicArcs to be ignored.

6236

In other words, I want to use itemAt as if there were no GraphicArcs on the scene, therefore returning the topmost GraphicNode at that position (if any). Is this possible?

wysota
16th April 2011, 09:23
Use QGraphicsScene::items() variant that takes a QPoint and iterate over the list you get until you find an item that suits your needs.