Build QML into an EXE
I want to make a skinned Windows desktop application, and want to seperate the GUI with the logic, so that later the application can change the skin
dymatically, like WinAMP.
After contacting support of Qt, they recommend me to use QML technology.
I understand the way to load QML file dymatically when the application is running, as below:
int main(int argc, char **argv)
QApplication app(argc, argv);
However, in such a case, I cannot find a way to bind the events(such as button click event) with the event handler(logic) written in C++(except to use a
PlugIn, which is undesirable). Can anyone helps?
Edit: added the code tags, gerolf
If you want your application to be based on QML, you probably won't have to interact with something like a button click event. After all, what you load in the viewer is your User Interface. But, for interacting with other C++/Qt functionality, you better read here:
I check your two links.
It seems QML is mainly used as a fast prototype in software engineering, that is, quickly building a software GUI so that the customer and know what is the look & feel of their application. However, the final delivered application may be better to use the pure Qt technology.
Am I correct?
No. QML is perfectly suitable for the end product.
Anyway, to put the QML into your .exe, load the QML from a Qt resource instead of from a file on disk.
OK. I see. Thank you so much. It seems:
If I using C++, then all the programming logic must be put outside.
If put QML as a Qt resource, then it is possible for others to take the QML outside the program and decode the programming logic, which is undesirable for most of the cases.