Important: Please read the Qt Code of Conduct -

QGraphicsItem scene()->itemAt() - get list of items?

  • Hey

    I'm dragging an item and while I drag it over another item I'd like to get a debug of what item/items are under my current item mouse position... But when I call scene()->itemAt(event->scenePos(),QTransform()) I get the currently dragged item and no more info. How can I get other items that are under the mouse while I drag?


  • @Dariusz
    Take a look at the items(...) functions.
    You might have to implement the shape() function for custom graphic items.

  • @kenchan I'm having dejavu. I could swear I did use that in past and I already asked for it sigh. Thanks! I think I'll get it solved, its coming back to me slowly!


  • For curious ones

    scene()->items(event->scenePos(),Qt::ContainsItemShape) / or other flag.

Log in to reply