Object factory

In a larger system with more comprehensive MasterController tests in place, having all of that object creation hard-coded inside the private implementation will cause problems because of the tight coupling between the MasterController and its dependencies. One option will be to create all the other objects in main() instead and inject them into the MasterController constructor as we have done with the other controllers. This will mean injecting a lot of constructor parameters, and it is handy to be able to keep the MasterController instance as the parent of all the other objects, so we will inject a single object factory that the controller can use for all of its object creation needs instead.

The critical part of this factory ...

Get End to End GUI Development with Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.