PDA

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



bmn
2nd October 2015, 13:40
Hello,


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()
{
myInnerClass->someSlot();
}

Thank you in advance.

Zlatomir
3rd October 2015, 00: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.