Qt World Summit: Register Today!

If parent and child are of same type how can we propagate the event to a parent widget?

  • Suppose my parent is of QWidget type and child is also QWidget type. In child event if i will write QWidget::event(e); how we can distinguish whether the event is propagated to parent or child.

  • If you get an event and call your base class, you call your base class. no other object. The propagation to the parent is done in the very base class itself and then always from child to parent, as the event is send to the child with the focus.

    If you are talking about custom events, they will never be propagated to another widget.

  • First the parent (and the parent of the parent until the QCoreApplication) dispacths it, but if the child (which has the focus or it is the destination) doesn't 'accept' it, it will be handled by the parent (and from the parent of the parent, ...).

Log in to reply