Ok, here are some points to start with.
- The lib you referred uses C++'s polymorphism to make calls to concrete observer class objects from a abstract observer class. You can make use of QtC++'s signals to make these calls.
- You can replace the virtual functions (be wise, to replace only the virtual functions which are used to realize observer pattern) in the abstract observer class with signals (these signals will still be new observer manager class).
- All the contrete observer classes which were derived from abstract observer class may no longer need do be so, i.e. they all can be indipendent classes (it's up to your design to have them in class hirarchy, to realize your functunality)
- In the abstract observer class's abstract implementation replace calls to virtual functions with emitting correspoding signals, as said earlier.
- In the new classes (which used to be contrete observer classes), implement corresponding slots, and and connect them to the observer manager class's signals (as and when requied to observe)
- Replace the abstract observer, with a contrete observer manager which manages the observer connections, observable contexts, topics, subjects etc
- Also, as expected all the new classes should be aware of the observable class, which is genreally used to register (connect a slot) an observation instance with concrete observer manager.
- When observing to no longer is needed then disconnet the slot (un-registering the observable)
Note that some of the terms used above may be generic in manner, just to give you a heading.





Reply With Quote

Bookmarks