Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.8.1
-
-
735556d19 (dev), 78ccc84dd (dev), e65451904 (6.9), 8454f7d2d (6.9), 49ee9d190 (6.8), 37f3331c7 (6.8), 5e8baedc1 (tqtc/lts-6.5), 0628ef436 (tqtc/lts-6.5)
Description
I have created a new project using QtCreator and selected CMake as build system.
Then I have added a new directory "Test" next to the already created "Main.qml", which contains the following files:
- Hello.qml
- qmldir
The qmldir file I constructed according to https://doc.qt.io/qt-6/qtqml-syntax-directoryimports.html#directory-listing-qmldir-files
It only contains the line "Bye Hello.qml".
With this in place, I can import the directory in my "Main.qml" by using "import "Test" as T" and use "T.Bye {}" without any issues.
Now, according to the above link, I should be able to also add JS resources to the directory. So I created a "test.js" file inside the "Test" dir and added a line to the qmldir file "Test test.js". The .js file contains this:
.pragma library
function Print() { console.log("Hello from Test") }
In my Main.qml file, I have added this:
... import "Test" as T ... ApplicationWindow { ... Component.onCompleted: T.Test.Print() }
When running this application via QtCreator, I only get the output: "The process crashed."
Attachments
For Gerrit Dashboard: QTBUG-132118 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
613101,3 | QtQml: Accept .js and .mjs files in directory-listing qmldirs | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
613112,4 | QtQml: Do not crash when loading .js files as QML | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
615200,4 | QtQml: Accept .js and .mjs files in directory-listing qmldirs | 6.9 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
615202,4 | QtQml: Do not crash when loading .js files as QML | 6.9 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
615671,3 | QtQml: Accept .js and .mjs files in directory-listing qmldirs | 6.8 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
615692,3 | QtQml: Do not crash when loading .js files as QML | 6.8 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
616121,3 | QtQml: Accept .js and .mjs files in directory-listing qmldirs | tqtc/lts-6.5 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |
616122,3 | QtQml: Do not crash when loading .js files as QML | tqtc/lts-6.5 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |