Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Custom c++ main arguments in qtloader.js



  • Hi,

    I have a webassembly Qt app using two main arguments for my main.cpp. I have added the flag --emrun to my .pro file like this :

    QMAKE_LFLAGS += --emrun
    

    so, I am able to pass argument to the program via the url like this:

    http://127.0.0.1:8000/?FIRSTARG&SECONDARG
    

    But I don't like passing argument via the url, I would like to add them in the .html or .js if possible.

    I have seen this change who seems to make the job, so I tried to add :

    Module['arguments'] = ["FIRSTARG", "SECONDARG"];
    

    at the same place in the qtloader.js but without success

    Is it possible? Do you have any clues ?

    PS : I am using Qt 5.14.2 with emscripten 1.38.27



  • Problem solved by removing the emrun flag. I can now specify custom arguments in the qtloader.js using emscripten's Module.arguments like this :

    Module['arguments'] = ['FirstArg', 'SecondArg'];
    


  • Problem solved by removing the emrun flag. I can now specify custom arguments in the qtloader.js using emscripten's Module.arguments like this :

    Module['arguments'] = ['FirstArg', 'SecondArg'];
    

Log in to reply