Qt Quick Application to C
-
Hi, I've started working with Qt & C++ in like 2 weeks. I created a simple app that shows a window with a button.
Is it possible to somehow export it as a .dll or .so and use it in a C project?
The goal is to show a UI in C. This project is deployed in an unattended terminal and the GUI will be shown there. -
Hi, I've started working with Qt & C++ in like 2 weeks. I created a simple app that shows a window with a button.
Is it possible to somehow export it as a .dll or .so and use it in a C project?
The goal is to show a UI in C. This project is deployed in an unattended terminal and the GUI will be shown there.@jabille said in Qt Quick Application to C:
Is it possible to somehow export it as a .dll or .so and use it in a C project?
Yes, for the first part. Simply build a shared library.
The second part doesn't work just like this...you can call some exported "extern" Qt C++ functions from C, but I don't think you are able to run the whole Qt GUI app from a C program.To call a single function in your Qt C++ app from C, see this topic.
As @VRonin mentions there, you can't call a class function from C, because C doesn't know classes...The goal is to show a UI in C.
Why not use proper C GUI Frameworks like GTK+?
And the title even says "Qt Quick"... I doubt you can run your QML GUI from your plain C program.
This project is deployed in an unattended terminal and the GUI will be shown there.
Moving to a C/C++ compiler is no option?! What is your hardware? Wouldn't it be better to move to a C++ compiler and program?! Either that, or use GTK+ like mentioned above.
-
@jabille said in Qt Quick Application to C:
Is it possible to somehow export it as a .dll or .so and use it in a C project?
Yes, for the first part. Simply build a shared library.
The second part doesn't work just like this...you can call some exported "extern" Qt C++ functions from C, but I don't think you are able to run the whole Qt GUI app from a C program.To call a single function in your Qt C++ app from C, see this topic.
As @VRonin mentions there, you can't call a class function from C, because C doesn't know classes...The goal is to show a UI in C.
Why not use proper C GUI Frameworks like GTK+?
And the title even says "Qt Quick"... I doubt you can run your QML GUI from your plain C program.
This project is deployed in an unattended terminal and the GUI will be shown there.
Moving to a C/C++ compiler is no option?! What is your hardware? Wouldn't it be better to move to a C++ compiler and program?! Either that, or use GTK+ like mentioned above.
-
That's how the OBS project is written : plain C core with C++/Qt UI. so yes it's possible.
-