I'm trying to figure out the C++ way of implementing a programming pattern that I use in Java.
I have a class that represents a view of my data used by the UI, and it wraps another class that contains the data my program is operating on (ie, model/view programming pattern). With this paradigm, while my view class can know details of the design of my model class, the model class should be independent of (ie, ignorant of) the view. I'm trying to figure out how to have my model alert the view that it has changed its state and that the view should rebuild itself.
In Java this is pretty straight forward with listeners, but C++ doesn't have those. Is there some convention C++ uses for this situation?
I'm trying to avoid using Qt's signals and slots for my model code. You need to extend QObject to use it and that imposes restrictions on what you can do, so I'm trying to keep classes that extend it only in the UI code.
Using a callback of some sort seems to be the way to go. Thanks for the suggestions.