Qt Model-View-Controller

前端 未结 3 632
说谎
说谎 2021-01-07 03:42

First of all I would like to say that I\' ve already read all the other questions about Qt and MVC, but I couldn\'t find what I\'m looking for. So please, unless you find so

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-07 03:58

    There are varying definitions of "MVC". If you mean Model-View-MEDIATING Controller, I think it is best to use the term MVA, i.e. Model-View-Adapter. Check this out: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93adapter

    A class called MainWindow is absolutely part of a view per this model. The fact that the object is window makes it a type of view. I have a program for instance with three views: GuiView, TerminalView, and ServiceView. Those are radically different interfaces, which use the same underlying model, and have an adapter in between. Note: I also a virtual base class "View" which the adapter uses and thus doesn't care if I swap out derived view types.

    There are plenty of ways to split up "views" other than the example I provided, but basically your view is how the user and/or client interacts with the program.

    A window class should not be storing information, by any varied definition or interpretation of MVC.

提交回复
热议问题