Suppose I have widgets, W1, W2, W3, W4 where W4 is a child of W3, W3 is a child of W2, and W2 is a child of W1.... and each widget is a private member of its parent.

Now W4 emits a signal, say do_something(), that I want to connect to a slot in W1. The way I do that is to make three separate connections.

Qt Code:
  1. in W3: connect(W4,SIGNAL(do_something()),this,SIGNAL(do_something()));
  2. in W2: connect(W3,SIGNAL(do_something()),this,SIGNAL(do_something()));
  3. in W1: connect(W2,SIGNAL(do_something()),this,SLOT(slot_do_something()));
To copy to clipboard, switch view to plain text mode 

But this means I need to declare two extra signals, and make two extra connections. And perhaps I have many such connections within my app.

Is there a better way to handle this type of situation? For example, should I use custom events?