Unsolved Can Qt be launched as a thread in c application ?
-
I want qt to be as frontend of my application , for which i am launching it (qt) as a seperate thread of my multi threaded application . The other threads of my code is written in c. Is this approach feasible , for qt to work or am i missing something here ?
Thanks -
If the Qt parts are the front end, the UI part, you don't "launch it as a separate thread", but have it as the main thread of the application, and launch the other functionality as separate threads as needed. The UI functions in Qt generally work only in the main thread.
-
@mvuori said:
The UI functions in Qt generally work only in the main thread.
Actually, the UI functions in Qt generally work only in the GUI thread (which is the thread that created QGuiApplication/QApplication)
The GUI thread does not have to be the main thread. See http://stackoverflow.com/questions/22289423/how-to-avoid-qt-app-exec-blocking-main-thread
@visiot said:
I want qt to be as frontend of my application , for which i am launching it (qt) as a seperate thread of my multi threaded application . The other threads of my code is written in c. Is this approach feasible , for qt to work or am i missing something here ?
ThanksIt is feasible (see my answer in the link above), but you will need to create a wrapper to call C++ functions from C. See http://stackoverflow.com/questions/2744181/how-to-call-c-function-from-c
-
See also this thread:
https://forum.qt.io/topic/67285/ui-application-as-thread-cpu-load-almost-100/11