Search code examples
c++qtipcdata-transfer

Data transfer between Qt and a C++ code


I have a C++ code and now I am thinking to prepare a UI with Qt since its language is also C++. Before attempting to do that I wonder how can I transfer data between my code and UI code. I mean, I do not want to write variables to a textfile and let UI to read it. Instead I want this to be done internally. I know this is possible but dont know where to start. Any idea?


Solution

  • Qt has a Signal and Slot mechanism that is meant for this purpose. Take a look at the examples here http://qt-project.org/doc/qt-5.0/examples-widgets.html This also works if the Gui runs in a Separate Thread but be careful to get Threading and Signals and Slots right: http://labs.qt.nokia.com/2010/06/17/youre-doing-it-wrong/