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. How to implement MVC using signals and slots

How to implement MVC using signals and slots

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 1.1k Views 3 Watching
  • 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.
  • A Offline
    A Offline
    AaronKelsey
    wrote on last edited by AaronKelsey
    #1

    I have developed a small application which has ended up with tight coupling where the UI classes contain a lot of business logic. I am wanting to separate the business logic and UI by implementing a controller class to handle this.

    I have thought of a couple of ways I could do this but I just don't think that they're suitable.

    A quick overview of my code base for this question to make sense.

    I have two classes CreateA/CreateB which currently implements the UI and a function called Create() in both which is full of business logic. I want to rename these classes to CreateA_UI/CreateB_UI, and create a Controller class which communicates with two new classes called CreateA/CreateB which will now contain the Create() functions.

    I am struggling to understand how I would structure this to efficiently and effectively use the Qt library, especially signals and slots, to create the MVC pattern and decrease tight coupling.

    Note: I am not using the Qt designer

    Pablo J. RoginaP 1 Reply Last reply
    0
    • A AaronKelsey

      I have developed a small application which has ended up with tight coupling where the UI classes contain a lot of business logic. I am wanting to separate the business logic and UI by implementing a controller class to handle this.

      I have thought of a couple of ways I could do this but I just don't think that they're suitable.

      A quick overview of my code base for this question to make sense.

      I have two classes CreateA/CreateB which currently implements the UI and a function called Create() in both which is full of business logic. I want to rename these classes to CreateA_UI/CreateB_UI, and create a Controller class which communicates with two new classes called CreateA/CreateB which will now contain the Create() functions.

      I am struggling to understand how I would structure this to efficiently and effectively use the Qt library, especially signals and slots, to create the MVC pattern and decrease tight coupling.

      Note: I am not using the Qt designer

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @AaronKelsey would it be worth to look at Qt's model/view architecture, instead of writing your own implementation of the MVC pattern?

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      3
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        @AaronKelsey Can you describe what kind of data does the UI collect from the user?the user can do through the UI? What kind of data do they enter

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        2

        • Login

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