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. Separate logic from GUI elements
Forum Updated to NodeBB v4.3 + New Features

Separate logic from GUI elements

Scheduled Pinned Locked Moved General and Desktop
12 Posts 7 Posters 8.3k Views 1 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #3

    Hi,

    There's no real tutorial about that matter. It's more about designing your core logic so that it doesn't depend on your widgets. e.g. the Model/View paradigm where you have part of the business logic in the model and you can change the view on top of without any problem.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Starting with thread is not really a good idea. Threading is a complex matter that should not be mixed in when learning how to decouple widgets and core logic.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Andre005
        wrote on last edited by
        #5

        I see this topic from the overall view. Its not deal wheater to use QThread class or other QT Classes.
        How I could develop the design and structure the project to decouple eg. algorithms and GUI elements?

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #6

          you can try reading
          http://qt-project.org/doc/qt-4.8/modelview.html

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andreyc
            wrote on last edited by
            #7

            One more option is to read about "MVVM":http://en.wikipedia.org/wiki/Model_View_ViewModel
            "One more reading":http://imaginativethinking.ca/mvvm101
            "And one more":http://msdn.microsoft.com/en-us/magazine/dd419663.aspx/

            There is no direct implementation of MVVM in Qt though.

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

              Hi,

              Please share a bit about your background with us, so that we can better understand how to answer your question:

              Where did you get this idea from? Why do you want to decouple GUI from logic?

              Have you developed projects in other languages before? If so, what languages are they?

              Do you already have a Qt program where the logic is not separated from the GUI?

              I think the easiest way to learn is to take a program that you've already written (point #3) and re-write it to separate logic from GUI. You can post your code here for us to look at and share tips.

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

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jafarabadi.qt
                wrote on last edited by
                #9

                Hi all,
                If i understand your question correctly...
                I think that searching about "inter-process communication" and "shared memory" can be useful.
                you can split your app in two part:
                Master(contain logic which it share result in part of memory)
                and
                Slave(contain GUI which it read and set data from shared memory)
                i am waiting for your answer...

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

                  Hi a.jafarabadi,

                  [quote author="a.jafarabadi" date="1414044298"]
                  I think that searching about "inter-process communication" and "shared memory" can be useful.
                  you can split your app in two part:
                  Master(contain logic which it share result in part of memory)
                  and
                  Slave(contain GUI which it read and set data from shared memory)[/quote]I don't think this is appropriate. "Inter-process communication" (IPC) and "shared memory" are for 2 different programs to communicate with each other.

                  Andre005 is asking about separating the GUI from the logic within one single program. This does not require IPC or shared memory.

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

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jafarabadi.qt
                    wrote on last edited by
                    #11

                    Oh, excuse me friends,
                    but he can see my comment as a suggest :)
                    thanks.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      Andre005
                      wrote on last edited by
                      #12

                      Hi,

                      thx for support guys.

                      [quote author="mrjj" date="1413981770"]you can try reading
                      http://qt-project.org/doc/qt-4.8/modelview.html
                      [/quote]

                      This link is a good start to cover the method an the background of this topic.

                      [quote author="JKSH" date="1414041964"]

                      Where did you get this idea from? Why do you want to decouple GUI from logic?

                      Have you developed projects in other languages before? If so, what languages are they?

                      Do you already have a Qt program where the logic is not separated from the GUI?

                      .[/quote]

                      I had listen to a course of software design. In this course they used java to explain the patern and it was used the related toolchain for that. They used adapter function to link the model with the GUI elements.

                      With QT and C++ i think it is a sophisticated framework to lear some GUI programming and it gives a gool result in a short time and it ist similar to approach of that course

                      In my former project i have only work on embedded systems, where GUI programming is not the focus.

                      As a QT programm you can take a look in this post:

                      http://qt-project.org/forums/viewthread/48602/

                      With this simple example, it could be discuss the separation of the Button functionality and the way (algo) the grid is build.

                      Regards,
                      Andre

                      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