Important: Please read the Qt Code of Conduct -

Does the iOS build of a Qt project support all standard Qt Javascript in QML including eval?

  • I would not expect that code you write in Qt that makes use of Javascript runtime would be possible in the iOS platform, can anyone comment?

    My understanding is that the only Javascript iOS has supported historically has been that which runs in a web browser view on the device.

  • Qt uses its own JavaScript engine (actually it uses Google V8 but that doesn't matter here I guess), it has nothing to do with the OS or platform (so it's not using anything from the iOS libs or anything to evaluate JS).
    I hope that answers your question, I am not sure what you want but you can use "eval" with QJSEngine, if you have to :D

  • My question is how can Qt offer runtime JS on the iOS platform when iOS has not historically provided this feature? Qt is not translating JS into some other type of code, JS runs as JS at runtime, so I'm curious how this is possible on a device or OS that doesn't support runtime JS in this way.

  • Qt has its own JS engine as I've said, in short it reads the JS string and evaluates it to native (c++) code on the fly. so it has nothing to do with iOS or other OS features.

    Just like a browser evaluates JS how do you think that works on iOS? e.g. the chrome browser uses the same JS engine as Qt, I don't see what that has to do with iOS?

    In the end the JS engine is just a native library like Qt itself, it has no dependencies to the operating system.

    Sorry I can't describe it any better, hope you understand what I mean. :)

  • Ok, so are you saying that a Qt app essentially has this JS engine embedded within it? So if you deploy to iOS for example, that app will have in its own independent app package a JS engine that interprets JS at runtime?

  • that is correct, the JS engine is embedded in the QML module I think.

    A JavaScript engine isn't usually that large, I don't know about the Qt version but for example "Mozilla Rhino": is only 1 MB as a Java archive so you can easy embed it in your app.

Log in to reply