Solved 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
View.cppbool View::eventFilter(QObject *target, QEvent *event){ qDebug()<<"eventFilter target"; // OK if (obj==target && event->type()==QEvent::GraphicsSceneMousePress){ qDebug()<<"mouse grabbed "; // OK event->ignore(); obj->grabMouse(); // Trying to take the mouseMoves from the View mouseMove event handler } event->accept(); return QObject::eventFilter(target, event); }
the object.cpp
void Object::mouseMoveEvent(QGraphicsSceneMouseEvent *event){ event->accept(); 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?