View Full Version : “Pass” slots from class to class

2nd October 2015, 14:40

I am currently struggeling with what is the best way to pass slots from the outer class to a class instance within it.
My problem is, that i have plenty of signals beeing emmitted by the inner class and it is quite easy to pass the signals on,
but how do i handle the slots? Is there any good way to pass them on, without having to do the following:

//Slot in the outer class
void outerClass::someSlot()

Thank you in advance.

3rd October 2015, 01:17
You have many options:
1) Call the slot manually (like your example)
2) You can connect multiple slots to the same signal: Connect both (all) slots to the signal that is connected to the outerClass::someSlot
3) You can connect signal to signal: Create a signal "chain": add a signal into outerClass this signal connect it to both (/all the slots you need) slots and connect the outside signal to this signal.

So you can choose depending on what works best in your project.