QT cant import js file into build
Hi,
I followed this tutorial [URL="http://www.developer.nokia.com/Community/Wiki/Porting_Simple_Android_List_Application_to_Symbian_with_Qt"]Porting Simple Android List Application to Symbian with Qt[/URL]
to create Database app.
As I suppose QT have problem with import js file needed to connect to DB.
When I click and hold any item and select edit I get in console this:
[CODE]
file:///C:/QtSDK/Simulator/Qt/mingw/imports/com/nokia/symbian.1.1/PageStack.js:132: Error: Error while loading page: file:///C:/Users/Michal/QT/Andjsapp-build-simulator-Simulator_Qt_for_MinGW_4_4__Qt_SDK__Release/qml/Andjsapp/EditPage.qml:3 Script file:///C:/Users/Michal/QT/Andjsapp-build-simulator-Simulator_Qt_for_MinGW_4_4__Qt_SDK__Release/qml/Andjsapp/script.js unavailable
file:///C:/Users/Michal/QT/Andjsapp-build-simulator-Simulator_Qt_for_MinGW_4_4__Qt_SDK__Release/qml/Andjsapp/script.js:-1 File not found[/CODE]
But when i add manually js file into:
[CODE].../QT/Andjsapp-build-simulator-Simulator_Qt_for_MinGW_4_4__Qt_SDK__Release/qml/Andjsapp/...HERE...[/CODE]
It works fine and it display Edit form.
[B]Is this a QT bug or its impossible to import js file in Symbian projects?[/B]
[B]And how can I import js file when I want to test it on Symbian Device?[/B]
Maybe its one line in *.pro file?
Any ideas?
App is available here: [url]https://dl.dropbox.com/u/6412001/Andjsapp.zip[/url]
I know there is tutorial for implement SQLite in c++ but its too complicated for me because I want to use qml for design views.
Maybe someone can share with me demo app where is used C++ implementation of SQLite and qml forms.
Best Regards, Michael
Re: QT cant import js file into build
It is a minor bug of yours actually. A qml file is searching JS files by default in the same folder it is into. So that makes it the folder {project root folder}/qml/Andjsapp. But your script file is in {project root folder}. So it is logical that it can't be found.
The best solution would be to:
- go in the folder {project root folder}/qml/Andjsapp and create a new folder called "scripts"
- In there add your JS files.
- In the EditPage.qml change the import from:
[CODE]import "script.js" as ShoppingListDb[/CODE]
to
[CODE]import "scripts/script.js" as ShoppingListDb[/CODE]
-finally remove from the .pro file the following lines:
[CODE]
OTHER_FILES += \
qml/Andjsapp/EditPage.qml \
script.js
[/CODE]
These are already handled by the qmlapplicationviewer.pri and since your .js files are now in the qml directory of the project you need to worry no more about their deployment.
Regards.
Re: QT cant import js file into build
Hi,
Thanks for reply
I've followed your instructions and now it works.