Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGraphicsScene ::itemAt() ,not returning the item[CLOSED]



  • @void MyScene:: mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
    {
    QGraphicsItem *item=itemAt(mouseEvent->screenPos(),QTransform());
    QPointF p1=mouseEvent->scenePos();//i get a valid point
    QPointF p2=item->scenePos();////i get (0,0) even when i click on a valid items

    update();
    QGraphicsScene::mouseReleaseEvent(mouseEvent);
    }
    @

    MyScene inherits :QGraphicsScene and QObject
    the items in MyScene :inherit QGraphicsItem


Log in to reply