You might want to profile where exactly things are slowing down (infact
your console.log calls should help as well). If its the model that is
taking too much time to populate, you should use a C++ model.

On Tue, May 3, 2016 at 11:02 PM, Kevin Mcintyre <kebi...@gmail.com> wrote:

> Given code like below where JSON data is used to populate a ListModel - I run 
> into loading issues on mobile when the number of objects returned is greater 
> than a couple thousand.s
>
>
> Once the item is rendered it performs as expected, but the time to ready is 
> often beyond user acceptance.
>
>
> Any suggestions greatly appreciated.
>
>  import QtQuick 2.5
>
> import QtQuick.Window 2.2
>
>
> Window {
>
>     visible: true
>
>
>     Repeater {
>
>         model: ['url1','url2','url3']
>
>         ListView {
>
>             delegate: Image {
>
>                 source: src
>
>             }
>
>             model: ListModel {
>
>                 Component.onCompleted {
>
>                     var xhr = new XMLHttpRequest();
>
>                     xhr.onreadystatechange = (function(data) {
>
>                         return function() {
>
>                             if ( data.readyState == 4 ) {
>
>                                 console.log('answered:', url)
>
>                                 try {
>
>                                     var js = eval('new Object(' + 
> data.responseText + ')')
>
>                                     for (var x = 0; x < js.length;x++) {
>
>                                         append({'src': js[x].src})
>
>                                     }
>
>                                 } catch (err) {
>
>                                     console.log('error:', modelData, err);
>
>                                 }
>
>                             }
>
>                         }
>
>                     })(xhr);
>
>                     console.log('request:', url)
>
>                     xhr.open('GET', modelData, true);
>
>                     xhr.setRequestHeader('accept','application/json')
>
>                     xhr.send('');
>
>                 }
>
>             }
>
>         }
>
>     }
>
> }
>
>
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>


-- 
Shantanu Tushar    (UTC +0530)
shantanu.io
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to