How to run Qt Application(GUI) from DLL?
-
wrote on 27 Jan 2021, 11:42 last edited by
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? -
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.
-
@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.wrote on 27 Jan 2021, 14:10 last edited by@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??? -
@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
1/5