Do the Qt signals/slots follow the scope of native C++?
Let's say I have the following classes: House, Kitchen, Cellar, Stove and Shelf.
class House {Kitchen kitchen, Cellar cellar;};
class Kitchen {Stove stove;};
class Cellar {Shelf shelf;};
Now I want to send a signal from the shelf in the cellar to the stove in the kitchen. Is the only way to do this by connecting a signal from the shelf to the cellar and a slot from kitchen to the stove and then in house connecting cellar and kitchen? Or is there a way to do this directly?
I have a class that needs to communicate with a user interface and I wonder if I need to "proxy" all the various signals/slots through intermediate classes. Or is this an indicator of bad design?
You can do the connection in any method of House, as there you can access both objects. The "connector" must be able to access both sender and receiver, at compile time, that's all there is to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With