Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Seperating GUI from Logic?
maybnxtseasn last edited by
Anyone have any advise or good reads on separating the GUI from programming logic using?
uranusjr last edited by
There is a nice "introduction":http://doc.qt.digia.com/qt/model-view-programming.html in official documentation
richelbilderbeek last edited by
For some applications, I develop a desktop (using Qt), web (using Wt) and console version (for example http://richelbilderbeek.nl/ToolSimMysteryMachine.htm has both a desktop and webversion). My personal trick is, how plain simple it may sound, is to let the GUI do only the GUI stuff (like reading edit boxes) and feed this to a GUI-less member dialog.
For example, a QtSomeDialog and WtSomeDialog both contain the same SomeDialog. The Qt dialog reads an edit box (as a QString) and passes it to SomeDialog as a std::string. The Wt dialog reads an edit box (as a Wt::WString) and passes it to SomeDialog as a std::string.
Personally, I enjoy doing this as my architecture has -IMHO- improved.
I wrote one tiny article about the subject: http://richelbilderbeek.nl/CppFromDesktopToWebApplication.htm