Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to get .exe parameters into QML app?
I have these in main.cpp:
int main(int argc, char *argv)
How do I get the provided parameters to my QML layer? Like, if my .exe is launched with a certain key and value, how is it possible to communicate this to the QML layer?
andre last edited by
I would do the argument parsing in C++, and just expose the relevant options to QML using a QObject with some properties.
I think I found how to parse the arguments with QCoreApplication::arguments(). But how do I comminucate the parsed stuff to QML? QmlApplicationViewer->rootContext()->setContextProperty ?
lgeyer last edited by
That's the way to go.
Ok, thanks, will try :D