Mouse events and filter



  • i've a problem with getting mouse release event in a specific situation. i capture child widgets events via "installEventFilter" and point them to their parent ("this")
    @
    bool mywidget::eventFilter(QObject *obj, QEvent event)
    {
    switch(event->type()){
    case QEvent::MouseButtonPress:
    QApplication::sendEvent(this,event);
    static_cast<QWidget
    >(obj)->setVisible(false);
    break;
    }

    return QObject::eventFilter(obj, event);
    

    }
    @

    as the code says, the pressed child gets hidden after the event has forwarded to the parent. now the mouse event has destroyed cuz the child's visibility went to false.
    The problem is here where i need to get the mouse release event but i don't get anything out.
    how can i transfer the event to the parent ("this") just like it is occurred for the parent? (keep it pressed)
    simply say getting the mousePressEvent() by child and mouseReleaseEvent() by parent


Log in to reply
 

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