Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Model view Controller Library

Model view Controller Library

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 2.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    luisvaldes88
    wrote on last edited by
    #1

    Well, I work as a software developer in a company. The system we maintain is an Enterprise Resource Planning, it is build on Delphi.
    We work with Oracle Database and the application is only deployed on Windows.
    My native language is Spanish, so sorry if my English is not good.

    I am a big fan of C++ and Qt, now I am working on a project to reach a bigger market that the current system can't reach, this application should acomplish some new requirements:

    -> Must be easy to creade CRUD Forms to watch, create and edit information of the database.
    I am trying to make a base library on the "MVC pattern". This MVCLib depends on Qt and "QxOrm library" to work with the database.

    The CRUD form has a panel with some action buttons, a tabbed pane with a Form that act as a List of the rows contained in the database, this list
    is always in the index 0 (zero) of the tabbed pane.
    We can think of this CRUD form as a QWidget that has a group of buttons inside a QLayout, we will call this form 'CRUDForm'.
    The second form is a QWidget that has a list of filters, widgets that work with QSortFilterProxyModel and a QSqlQueryModel to show information of the database, this information
    is showed in a QTableView and whenever the user double clicks a row, it should create another widget to show the more specific information. This form is called 'CRUDListView'.
    The more specific widget to show the information of a 'CRUDListView' double clicked item is a form created by the programmer that implements the specialized form. But this form
    already have three widgets inside, they show a base and standard information of the entity, this form is called 'CRUDEntityView', all the widgets that can edit data
    have the same name of the datasource property that it edits, these widgets are handled by an DinamicWidget object that receive events from the widget.
    The DinamicWidget is an adapter class, it has a list of slots that are connected to diferent kind of signals, and it convert every signal received to a setValue(QVariant) slot
    that emits changeValue(QVariant) signal, setValue(QVariant) receives new values from the widget and emits a changeValue(QVariant) signal that is connected to a DinamicItem object.
    The DinamicItem object is inside 'CRUDEntityModel' and updates the data of the model.
    The 'CRUDForm' is able to show many diferent entities at the same time, it does not show an entity twice. The form can edit data of only one entity at a time.
    Theese Forms are the base widgets of the library. I did not have time to make a better explanation, but is a good start.

    I designed a base QxOrm class that will be the base of all concrete entities of the application, so all the entities will have the same base information always.

    The library is divided in 5 (five) packages:

    • global: here I have the Q_DECL_EXPORT and Q_DECL_IMPORT #defines

    • core: here are the clases that handle the events between the model and view, is not exactly the controller, but is something like that, although there is a class that connects to the database and bring the idValue of a new entity at the time it is inserted.

    • models: here are the models 'CRUDListModel' and 'CRUDEntityModel'

    • views: here are the views 'CRUDListView' and 'CRUDEntityView'

    • factories: here is the AbstracFactory that has the methods to create an instance of 'CRUDListView' and 'CRUDEntityView'

    This part is the one I want to discuss in this thread.

    -> Must be self updateable over the internet
    The main application is the ERP system, but in my plan is a second application, an Server/Client application that changes files of a new release.
    That is why the application must be sort of a plugin based application, to allow it to be upgraded easily without changing the main application.

    This part is not for discussing in this thread.

    -> Must have a help system included.

    This part is not for discussing in this thread.

    As I said, ia am big fan of C++ and Qt, but I am not an expert, that is why I came to this forum, to search for the opinions of experts.
    May by there is a better and diferent aproach, I read about the ItemDelegates, but they do not meet the requirements I have.

    I hope you could have time to share your knowleadge with me!

    Best Regards.

    Muchos quieren, pocos pueden, algunos consiguen.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      luisvaldes88
      wrote on last edited by
      #2

      .

      Muchos quieren, pocos pueden, algunos consiguen.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        luisvaldes88
        wrote on last edited by
        #3

        .

        Muchos quieren, pocos pueden, algunos consiguen.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved