Search code examples
c++visual-studio-2015visual-studio-2008qt4qt5

What's the best way to connect a Qt4 and a Qt5 process by IPC?


I want to build an application which is based on two separate processes. One of them (Process 1) is using Qt4 for accessing the functionalities of a legacy code base. The other one (Process 2) is the UI layer of the application using Qt5.

I'll need to access the functions of Process 1 from Process 2, and I'll need to access the results of Process 2 from Process 1.

Can anyone suggest a best practice for connecting the two processes via IPC?


Solution

  • http://doc.qt.io/qt-4.8/ipc.html

    According to the link you have to choose between TCP/IP (QNetworkAccessManager etc.) or Shared Memory with (QSharedMemory). In your case DBUS would not be a good idea as you are working on windows. I can also suggest to have a look at QProcess, through that you can make your QT5 application execute your QT4 application and collect the result from standard output.

    It depends a lot on how much data you need to exchange and how flxible you are with your legacy stuff.

    Personally if it is possible I would go for the QProcess.