How to use GUI in a DLL file by QT5.3.1
-
It's not that simple. This scenario (running Qt UI as a plugin in non-Qt program) is a lot more challenging than simply calling show on a widget.
First of all you need to make sure that your app can find and load all the necessary Qt dlls including core stuff, platform plugins, image plugins etc. If it can't it will just crash.
Second - Qt needs a valid QApplication instance existing in the main thread throughout the life of all the widgets. As a main thread I mean the thread the UI is going to run in.
Next - Qt types need a running event loop to properly dispatch events and signal/slot connections. This generates a problem, because if you simply start an event loop it ill allow Qt types to work but will effectively freeze the rest (non-Qt) of the app untill you exit the loop. This bring us to the final point.
Last but not least - to make this all work and not to block your main app you need to run the Qt part in a separate thread and manage it properly.
This topic has been discussed several times in this forum so for more details you might want to use the search.
-
This post is deleted!