Problem with import Javascript
Solved
QML and Qt Quick
-
wrote on 18 Apr 2016, 15:07 last edited by
hi!
i have a problem with javascript.
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 ?
-
Hi,
Do you have a .qrc file in your project ? Does it include script.js ?
-
wrote on 19 Apr 2016, 07:13 last edited by
hi!
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>
thanks!!
1/3