Qt World Summit: Register Today!

How can I let the parent widget and the child controls both get the mouse event?

  • I need rewrite the father widget's mousemove event.But when the the mouse is in the area of child control,the father widget can't get the mouse event.If i set the child control "setAttribute(Qt::WA_TransparentForMouseEvents)" ,then the child can't get the mouse event.
    Is there a way let the father and the child both get the mouse event?

  • Moderators

    Reimplement the mouse event in child and set 'accepted' property to false. This will pass the event to the next widget in the hierarchy.


  • but I don't want to change the child widget's code.

  • Moderators

    Then you won't get the result you need. The only other possible solution that comes to my mind is to install a custom event filter, but I don't have any experience in that area.

Log in to reply