QGraphicsObject intercept touch event



  • I've a QGraphicsView, a QGraphicsScene, and a QGraphicsObject. I can manage the touch event as mouse event in the QGraphicsView but I want the QGraphicsObject to manage its touch event. Is that possible?



  • Sure just re-implement those:
    @
    virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * mouseEvent)
    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent)
    virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent)
    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent)
    @



  • thank you. Is possibile to avoid the touch propagation if the QGraphicsObject consume it?

    EDIT: It does not work. The QGraphicsObject does not receive mouse event. MayBe because the QGraphicsView does not propagate it?



  • Yes, just make sure to call.
    @
    mouseEvent->accept();
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.