Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. item GrabMouse() never deliveres the messages to the item's mouseMoveEvent

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

Scheduled Pinned Locked Moved Solved General and Desktop
1 Posts 1 Posters 348 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    ddze
    wrote on last edited by
    #1

    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.cpp

    bool 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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved