i created a Qt Quick Controls Application, and than i have created a script.js with qctreator.
this file was automatically created in Other files directory.
on my main.qml i have added this line:
import QtQuick 2.6 import QtQuick.Controls 1.5 import QtQuick.Dialogs 1.2 import "script.js" as Script
and this is the error:
QQmlApplicationEngine failed to load component qrc:/main.qml:4 Script qrc:/script.js unavailable qrc:/script.js:-1 File not found The program has unexpectedly finished.
where am I doing wrong ?
SGaist Lifetime Qt Champion last edited by
Do you have a .qrc file in your project ? Does it include script.js ?
ok, i added the file into the qml.qrc, and it works:
<RCC> <qresource prefix="/"> <file>main.qml</file> <file>MainForm.ui.qml</file> <file>script.js</file> </qresource> </RCC>