Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt for MCUs 2.6
-
None
Description
in the big qt documentation about importing js files(https://doc.qt.io/qt-6/qtqml-syntax-imports.html#javascript-resource-imports), it's said that developers can import .js files into the qml document and use the functions defined in it.
i've tried if this also works in qt for mcus projects.
it turned out, with this code, qt for mcus application didn't compile:
// JSexperiment.qml import QtQuick import "myjs.js" as JS Rectangle { Text { anchors.centerIn: parent text: "Qt for MCUs" } Component.onCompleted: { console.log("Qt for MCUs is ready!") JS.func() } } // myjs.js function func() { console.log("form js") }
the error:
C:/Users/81808/Downloads/JSexperiment/JSexperiment.qml:2:1: error: path 'myjs.js' not found import "myjs.js" as JS
in the meantime, the code worked in the big qt 6.6:
// Main.qml import QtQuick import QtQuick.Window import "myjs.js" as JS Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Component.onCompleted: { console.log("Qt for MCUs is ready!") JS.func() } } // myjs.js function func() { console.log("form js") }
i've checked if this is written in the known issues or limitations of qt for mcus 2.6 but i couldn't find it.
https://doc.qt.io/QtForMCUs-2.6/qtul-known-issues.html
the projects used for the experiment are attached to this Jira ticket.