MVP Using Qt



  • Hello all !
    Can someone help me to find any good links for tutorials/examples for MVP (Model-View-Presenter) using Qt.

    Thanks & Regards,
    Narayanan K





  • Hi,
    I was looking for Model View Presenter (MVP) which I feel is somewhat different from MVC. Kindly correct me if my understanding is wrong.

    Thanks & Regards,
    Narayanan K


  • Moderators

    since Qt provided classes follow the MVC principle you would have to code your own classes to implement the MVP pattern.

    A rather "dirty" way to achieve what you want would be to get all the logic inside the model, when you want to use Qt provided classes.



  • Hi,

    imho comparing qt MVC principle with whatever application design pattern MVC,MVP,MVCP is confusing, since the first one has an architectural focus and the second one has the "real" application design perspective. Qt MV, like MS MFC doc/view architecture, focused on how to display a model object data in several different views(in general of the same type, I mean it's not trivial to display a tree model in a list view): I have not longer mentioned the controller part because qt doc says "If the view and the controller objects are combined, the result is the model/view architecture", I think by setModel() view, meaning that the model is manged direct by view, without any controller class. The model's internal data is meant to be actually the data model in the application's MVC design, or part of it in most of the cases. The application MVC design has different perspective and for simplicity I would say : an UI has more than one view widgets and it displays data models whose parts are integrated in qt views models.

    in MVC, the controller object, at some point in the application, must become aware of model and view, in some applications even it creates them and it is the bridge between them. The controller must be accessible from anywhere in the application, or at least from any view. Now the presenter takes some roles from the controller: it is the bridge between one view and the controller, it creates the view, and have methods called in view(UI) event handlers: in this way the UI is kept very light, as much as possible having just the creating and event handling code; the interaction with the rest of the application is done through the presenter: the presenter updates data (through app controller->model) and shows them in the related view. Actually as far as I know it is practiced that for any different view is there a different presenter in the application...



  • Thanks a lot for the reply...
    It was really useful.

    Thanks & Regards,
    Narayanan K


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.