I am a total newbie to Qt. As I was reading the documentation, I came across this configuration:
connect( Object1, Signal1, Object2, slot1 )
connect( Object1, Signal1, Object2, slot2 )
What could possibly be the use-case for this?
Looks odd to me coming from an Erlang/Python background. It must have to do with C++ inheritance twists and turns I guess.
This is for cases when you have something like one button that changes two parts of another. It may sound silly, but it would be equivalent to calling the second slot function from the first slot.
Say, clicking the play/pause button makes the stop button active or in active and also changes the tool tip. This could easily be done with one slot, but you may want the option to do them independently other times. To promote reuse, you use the above method of connecting one signal to 2 slots.
It would allow other objects to trigger slot1 and slot2 separately.
connect( Object1, Signal1, Object2, slot1 );
connect( Object1, Signal1, Object2, slot2 );
connect( Object3, Signal1, Object2, slot1 );
connect( Object4, Signal1, Object2, slot2 );
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