magland
6th October 2007, 11:11
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.
in W3: connect(W4,SIGNAL(do_something()),this,SIGNAL(do_s omething()));
in W2: connect(W3,SIGNAL(do_something()),this,SIGNAL(do_s omething()));
in W1: connect(W2,SIGNAL(do_something()),this,SLOT(slot_d o_something()));
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?
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.
in W3: connect(W4,SIGNAL(do_something()),this,SIGNAL(do_s omething()));
in W2: connect(W3,SIGNAL(do_something()),this,SIGNAL(do_s omething()));
in W1: connect(W2,SIGNAL(do_something()),this,SLOT(slot_d o_something()));
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?