[Qt-qml] ListModel and WorkerScript limitations
ari.koivisto at nokia.com
ari.koivisto at nokia.com
Tue Sep 7 14:20:34 CEST 2010
Hi,
I've been using QML for a small personal utility program which uses a service that replies in XML. Parsing the XML via XmlListModel didn't work due to its limitations - mainly due to nested data and that I need the strict ordering of child nodes, hopefully some help will come via: http://bugreports.qt.nokia.com/browse/QTBUG-12953 .
As a workaround I wrote a separate XML parser using XMLHttpRequest and traversed the response XML document via the means available through the reduced DOM API. This populates a ListModel that can be shown to the end user via ListView. This is working fine, but I'm facing additional hurdles:
(0. The DOM API could be more complete, now the JS I wrote is not exactly pretty)
1. In my case the server response document can take a while to process - few seconds on embedded devices -> I'd like to use WorkerScript to prevent the UI getting stuck, but I can't: "If a list model is to be accessed from a WorkerScript, it cannot contain list data." Well, that is exactly the case I have and I can't modify the ListModel to work without list data
2. While looking at WorkerScript I noticed that I couldn't pass the responseXML to the WorkerScript via SendMessage. WorkerScript gets stuck when trying to access the object - e.g. "response.childNodes.length". Moving the whole XMLHttpRequest to WorkerScript doesn't work either ("TypeError: Result of expression 'doc.responseXML' [null] is not an object.")
If WorkerScript is out of the game, what can I do to maintain UI responsiveness? I've managed to stay out of writing C++ extensions till now :).
Best Regards,
Ari
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100907/05dcb5f0/attachment.html
More information about the Qt-qml
mailing list