The program has components that are responsible for a certain functionality. The component is implemented using MVC, (Model, Controller, View classes). There is a main window class MainWindow. Each Controller class connects to it. It is necessary that each Controller has access to another, even to the model.

The solution may be to create an Application class in which all Controller classes and MainWindow are connected. Make a namespace in which to make a function that will return a pointer to an Application object. Through specify access to the Controller is obtained.

In Controller, make a public model () method that returns the model.

  • one
    "It is necessary that each Controller has access to another, even to a model." There is a suspicion that there is a problem with the architecture - Bearded Beaver
  • Access is needed because a data record is created in the controller, in which there is an external key from the model of another controller. And in the dialog, the user selects an entry from that model. - LFDS
  • The data of the second controller is displayed in the main window. In the first controller, a dialog is invoked to select records. That is, I do not want to create another model, but to refer to the one that is already in memory, but in another controller. - LFDS
  • If a component is something that can function without another, then it means that I incorrectly divided into components? But if the model has a relational relationship. - LFDS

0