Programming with Qt Quick for Symbian and MeeGo Harmattan Devices
-
I am using Qt SDK 1.1.4.
Qt Creator 2.4.0
Based on Qt 4.7.4 (32 bit)
Built on Dec 16 2011 at 03:25:42Currently my qt SDK is up to date.
I was very happy when I found the document Programming with Qt Quick for Symbian and MeeGo Harmattan Devices version 1.1 released December 13, 2011. This is the latest version I could find.
I have downloaded it and try to follow it. Then I got disappointed.
The guide can be downloaded from this link
http://qt.nokia.com/learning/guides/When I create Hello World as described in chapter 2 Using Qt Creator to Setup the Project
there are many differences from my code and code explained in the PDF document.
I am new to Qt and this is confusing me.- In my code which is auto generated when I create new Qt Quick project top level element of the main.qml file is pageStacWindow. In your documentation the top level element is window.
- In my auto generated code main.qml is importing QtQuick 1.1 and in your PDF it is importing QtQuick 1.0
- You have ToolBar element and I have ToolBarLayout element.
- You declare element StatusBar and in my code I just see properties showStatusBar: true
showToolBar: true
So my question is which code should I use?
Why so many differences from documentation and real life?
This is really making learning curve steeper. -
Hi,
I am still reading your
"Programming with qt quick for Symbian and MeeGo Harmatan Devices" Release 1.1
I have found it at:
http://qt.nokia.com/learning/guides/On page 46 CheckBox doneField is anchored to titleLabel element. This element isn't declared in this file.
Also TextArea noteField is achored to noteLabel. This element also isn't declared in this file.
Because of this I am getting Reference Errors:
file:///C:/QtWork/Learning/ToDoList/TodoList_Skeleton-build-simulator-Simulator_Qt_for_MinGW_4_4__Qt_SDK__Debug/qml/TodoList/pages/TodoPage.qml:82: ReferenceError: Can't find variable: noteLabel
file:///C:/QtWork/Learning/ToDoList/TodoList_Skeleton-build-simulator-Simulator_Qt_for_MinGW_4_4__Qt_SDK__Debug/qml/TodoList/pages/TodoPage.qml:64: ReferenceError: Can't find variable: titleLabelI am beginner here and lots of things are new to me. Things like this are really making harder to understand the big picture.
Could you please update your learning materials, or at least answer my questions?Thanks
Edited 26.01.2012.
There is a newer version of the guide available for download. The version is updated 24th of January 2012. It still has the same version 1.1 but there are some changes on page 46 -
Download the tutorial again, was updated 2 days ago. ^^
-
Hi GentooXativa,
Thanks for the news. I downloaded new version of the guide released 24th of January. The version number is still 1.1.- On the page 11 they are still using Window element
instead of PageStackWindow as an root element - still importing QtQuick 1.0
- in the guide there is still ToolBar instead of ToolBarLayout
- StatusBar element is used instead of showStatusBar: property
All these are already mentioned in my first post
http://developer.qt.nokia.com/forums/viewthread/13200/
They have fixed my other issue with missing elements titleLabel and noteLabel.
http://developer.qt.nokia.com/forums/viewreply/71746/Thanks for that, but please address my first post also. I also think they should incorporate change log to their document.
- On the page 11 they are still using Window element
-
I think they still with QtQuick 1.0 to keep the compatibility with Symbian^1 devices.
QtQuick 1.1 is supported after 4.7.4 and s^1 still with 4.7.3
-
Here are some other questions I would like to be answered inside this tutorial.
- Where is SQLite database? I mean in which file is it?
- How can I create my own database from scratch? I want to create a list of my favorite ice cream shops. My app will only read this database and display it in a list. Do I create a new app in which I enter ice cream shop name, address and telephone number to a database? Afterwards I just transfer my database to another project that just reads data from it? There must be a smarter way to do this.
On the page 19 of the guide I am directed to use the skeleton code. On the page 42 under Chapter "Getting Data from the Database" the data is already there. I would like if someone explained how the data got there, and how can I create this data from scratch.
-
Well, the destination of SQLite depends on the configuration directory for your application, that depends if you configured your application information with
@
QCoreApplication::setOrganizationName("GiGiGo");
QCoreApplication::setOrganizationDomain("gigigo.com");
QCoreApplication::setApplicationName("appTest");
@
That saves all your content into:
@C:\Users$Username\AppData\Local\GiGiGo@on windows and into $HOME/.config/GiGiGo under linux.
Another way is specify the full path for the SQLITE database, for example with:
@
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("C:\myStuff\MyDatabase.sqlite");
@To create your own database, you should open the database, and work with them like any SQL database, creating the tables and populating them with INSERTs
@
QSqlQuery query; query.exec( "CREATE TABLE uiPanel( ID INT(10), Name TEXT, isActive INT(1), Version INT(10));CREATE TABLE uiTargets( ID INT(10), Name TEXT, Doc TEXT, Version INT(10));");
....
QSqlQuery query; query.exec( QString( "INSERT INTO uiPanel (Name) VALUES ('%1');" ).arg(npanel->getName()));
@
-
Hi GentooXativa,
Thanks for helping me out :) I am beginner so I don't understand everything you have said.- I am flowing the guide and I am using QML and JavaScript to access SQLite database.
My guess is that all the code you have mentioned like
@QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("C:\myStuff\MyDatabase.sqlite");@should go to main.cpp file? But in the guide we don't edit C++ code because we are using QML and JavaScript.
On the page 36 of the guide you can see that there are 2 functions in JavaScript file ceore.js
@.pragma libraryvar _db;
function openDB()
{
_db = openDatabaseSync("TodoDB","1.0","the Todo related Database",1000000);
createTable();
}
function createTable()
{
_db.transaction(
function(tx){
tx.executeSql("CREATE TABLE IF NOT EXISTS todo (id INTEGER PRIMARY KEY AUTOINCREMENT, box INTEGER, done TEXT, title TEXT, note TEXT, modified TEXT)");
}
)
}@The functions are openDB() and createTable(). But there is no path to the file congaing the database
- So basically what you are saying is I should create sepearete app to populate my database. I was hoping that there is a tool for this.
- I am flowing the guide and I am using QML and JavaScript to access SQLite database.
-
True, sorry :D I posted the C++ way ^^
On QML/JS based application you can obtain the path where databases are stored using
@qDebug() << "Offline storage path: " << viewer.engine()->offlineStoragePath() << "/Databases";@
on your main.cpp file.
Sorry for the confusion ^^
-
Thnx!
I have inserted you line right before
@return app->exec();@It worked fine and now I know that my database is located in
@C:\Documents and Settings\MyUserName\Local Settings\Application Data\Nokia\QtSimulator\data\QML\OfflineStorage\Databases@- What I don't understand is how did it got there?
I have downloaded skeleton code and I have extracted it to the folder
@C:\QtWork\Learning\ToDoList@
I do realize that I have created this database when I called openDB() and createTable() functions, but I don't understand where did the data that is inside the database came from? Where did all the ToDo Items came from? I didn't create them and I didn't put them in database.
- Inside my Databases folder I have two files. One is:
36041e28b36e413b13ff35faed025eaa.sqlite
and this is the database itself
Second one is:
36041e28b36e413b13ff35faed025eaa.ini
and inside I have:
@[General]
Name=TodoDB
Version=1.0
Description=the Todo related Database
EstimatedSize=1000000
Driver=QSQLITE
@
Lets say I want to create a new app that only reads SQLite database. In the DB I would have names, addreses and other info about ice cream shops :) So I have created new project using Qt SDK and everything is inside my project folder
@C:\QtWork\Learning\IceCreamShops@
Where should I put my database I have created with another application?
I mean there is already a database with a strange file name from my ToDoList project inside@C:\Documents and Settings\MyUserName\Local Settings\Application Data\Nokia\QtSimulator\data\QML\OfflineStorage\Databases@
If I put my IceCreamStore database inside too how will the app know which database to open?
- What I don't understand is how did it got there?
-
I dont know how exactly works the database naming on QML, i created a empty database, took his name and download a file with that name and put it into storage directory.