Important: Please read the Qt Code of Conduct -

What syntax exactly is supported for JS resources imported from QML?

  • This isn't really a Qt Quick question, it's a QML question but this seemed the most fitting subforum.

    I used to think that, when you import a JS resource from QML, this JS file can contain only standard JS code. Then I came across 2 exceptions:

    • the .import statement
    • the property keyword (in JS), which seems to be only used in code-behind files and apparently adds a property to the QML component that imports the JS

    What other "extensions" are there in JS when imported from QML, as compared with standard JS?

    And I'd like these two, as well as any other extensions to the JS language, described in full (e.g. with a link to the docs). For example, what's the difference between declaring a global JS variable with and without the property keyword?

Log in to reply