Nominate our 2022 Qt Champions!

item GrabMouse() never deliveres the messages to the item's mouseMoveEvent

  • The instance that creates an event filter during the dragMoveEvent registers the event filter with:

    obj->installEventFilter(this);  // OK  , this is the (View class) 

    than the event is called while grabbing an item

    bool View::eventFilter(QObject *target, QEvent *event){
        qDebug()<<"eventFilter target"; // OK 
        if (obj==target && event->type()==QEvent::GraphicsSceneMousePress){
            qDebug()<<"mouse grabbed ";  // OK 
            obj->grabMouse(); // Trying to take the mouseMoves from the View mouseMove event handler 
        return QObject::eventFilter(target, event);

    the object.cpp

    void Object::mouseMoveEvent(QGraphicsSceneMouseEvent *event){
         qDebug()<<"Object moveEvent called "; // FAILED

    Is the mouseGrab appropriate way of dispatching the events from one class to the next? Or is there a way to do this?

Log in to reply