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."