I was wondering about the design pattern behind the signals and slots mechanism in Qt?
I am hesitating between the mediator and observer one?
Thank you...
QT's signals and slots is an implementation of the Observer pattern. If you want to know more about it, I recommend reading A Deeper Look at Signals and Slots which motivates it and compares it to Boost signals. Otherwise, there's always the QT docs.
If you want to use the Mediator pattern instead of the Observer pattern, it would be fairly trivial to do this using QT. You'd have to add a mediator class into the mix, and make it your observer of the events of interest; i.e. move the slots and most of your update logic from your regular observers to your mediator.
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