In addition, it could be quite useful to declare pure virtual slot void Observer::update( Source * changedSource ) = 0; in Observer class, this way all observers will share the same interface for receiving updates.
Maybe its a little detail, but I'd leave management of Observers to Watched class. In typical observer pattern ("Gang of Four"), Watched object defines methods for adding and removing Observers, so creating connection could be a part of Watched::add(Observer * o) method (and Watched::remove(Observer* o) could simply call this->disconnect(o)).observer (also a sub-class of QObject) will connect its slot to the emitted signal
Bookmarks