Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to run Qt Application(GUI) from DLL?
-
Hello everyone.
I need your advice. How to run Qt Application(GUI) from DLL? I have a console application C++, and I want to load DLL then run Qt application GUI from that DLL. How can I do that?
-
@Konstantin13
same way you would do in an application/exe.
Start a QApplication event loop.
But note that each process (the instance loading your dll) can only have a single QApplication. If thats not possible you will need to launch a separate process from within your dll and communicate with the launched application.
-
Or turn around the dependency - create a lib with the functionality of the console application and then use this library from a console or gui app.
-
@raven-worx thank`s, I did as you say and everything works!
I have already familiarized myself with the problems associated with processes. Now I have a new question : how I can communicate with UI(Qt) from my application and back???
-
@Konstantin13 said in How to run Qt Application(GUI) from DLL?:
how I can communicate with UI(Qt) from my application and back???
https://doc.qt.io/qt-5/ipc.html
or
https://doc.qt.io/qt-5/qtremoteobjects-index.html