06-18-2012 05:44 AM
Hello devs.I am a newbie in developer world so please give advice.
I am trying to make a simple app with cascades. I've done all my qml and everything is working ok so far. This is where i am stuck. I want to make a page that gets data from the web and actually from http://betognosis.com/pamestoixima/index.php
I think it is a simple text page. Then i want all this data to appear in my qml page as a table but only some of the elements. not all of the data of each row. just the first 7.
What should i do? or what should i study/read before trying to do that myself?
06-18-2012 06:01 AM
You can get the data from the web via c++ and provide it to the qml when it arrives eg.
Youll also need to implement a slot to receive the data when it arrives and connect it to the signal from the QNetworkAccessManager that gets emitted when its ready.
connect(_NetAccMan, SIGNAL(finished(QNetworkReply*)), SLOT(slotReplyFinished(QNetworkReply* )));
void MyNetworkClass::slotReplyFinished(QNetworkReply* )
QString Text = QString::fromUtf8(Dev->readAll());
// now pass Text to QML if necessary
06-18-2012 06:52 AM
Man thanks for the reply. I'll give it a try. although an example should be better. lol.
I imagined something like TableView or many ListViews....It is much more complicated. Or i say this because i am new.Anyway thanks. I ll be back for instructions.Thanks again.
06-18-2012 09:22 AM
It is complicated. Im not sure if theres a good way to get the date more directly in qml.
If I understand you have to download a whole page (as opposed to each item in a listview being separately downloadable which might be much simpler) , and then provide various parts of this to qml in a List or Table.
My way would to create a controller (C++ class) that gets the complete data/page from the webpage when necessary ..see eg http://doc.qt.nokia.com/4.7/network-download-main-
Then this class can provide the data to the Qml page, containig eg a ListView or TableView its controlls.eg via context properties or context items
(1) If I were you I would first write an example that displays (dummy) data the way you want it in a ListView.
(2) When tahts working I would try to get the data from a C++ class (see also http://doc.qt.nokia.com/4.7-snapshot/qtbinding.htm
(3) When thats working I would get theC++ class to get the data from the web via QNetworkAccesssManager.
-If- each elemnet of the listview were available as a separate url you could simple refer to this url in the delagate of the listview item (completely in QML)..see eg
Im presuming the Nokia versions work similarlyn to the blackberry versions here (I find it easier to find doc at the Nokia site)
06-25-2012 04:07 AM
Hello again. I watched the webcast and at the end i asked about my thing. They told me i should wait for the next release of cascades.ListView will have many more options and i should be able to accomplish what i want in a much more easier way. Thanks mate for all the advice anyway.
06-25-2012 10:03 AM
See also the knowledge base articles on DataModel:
The second article describes exactly how to to what you want in R4 by using your own DataModel. The second article might be easier to understand if you first read the first article.
07-09-2012 10:16 AM
actually i am a little bit lost and confused. I was told during the webcast that the next release of native 10skd will help me. so i am waiting for it and then i ll get back . Thanks though!
08-09-2012 07:33 AM
guys thanks for all the responses. i can't figure it out yet.... lol....
and the link is not reliable. it was down for about two weeks so i cannot depent on it.
this was very helpful actually in case of newbies like me.
Anyway, an rss feed sample code or a more complex web xml feed would be nice. we like sample codes and you know it! anyway, thanks again for all the answers you gave me. i ll be back!