[Qt-qml] ListModel and WorkerScript limitations
aaron.kennedy at nokia.com
aaron.kennedy at nokia.com
Wed Sep 8 05:34:13 CEST 2010
Hi,
On 7/09/10 10:20 PM, "Koivisto Ari (Nokia-MS/Helsinki)"
<ari.koivisto at nokia.com> wrote:
> 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)
Yes, the DOM API is quite a minimal subset of the full W3C spec. Your best
bet is to file bugs against the parts that you want, or, better yet, submit
some patches! We'd love to see contributions in this area.
In the future we are looking at sharing the webkit implementations of these
constructs, which obviously support the entire spec, but that is not
scheduled for any particular release.
> 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
That is a limitation of the current implementation that is non-trivial to
fix. Future releases of QML will included better model data support that
will hopefully help with this problem.
> 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.²)
I can't reproduce this. The attached example uses XMLHttpRequest from a
worker script and it seems to be able to access responseXML without issue.
Can you provide more details about your problem - like the specific release
of Qt you are using and, ideally, a self contained example of the problem?
Cheers,
Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: workerscript_example.tar.gz
Type: application/octet-stream
Size: 483 bytes
Desc: workerscript_example.tar.gz
Url : http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20100908/909356fb/attachment.obj
More information about the Qt-qml
mailing list