Slow schedule, how to speed it up?



  • Hello,

    I'm working in QML on a schedule-view for 1 day.
    On the top I have a timeline, going from midnight to midnight.
    The schedule is divided in multiple subject, where each subject has it's own row.
    The schedule has an average of about 500 elements, but this can be a lot more (or less) in some cases.

    Edit: A small visualisation of how the schedule is organized: "http://img52.imageshack.us/img52/5369/schedulek.png":http://img52.imageshack.us/img52/5369/schedulek.png

    I've put all the elements in a flickable, because it's way too big to fit on the screen at once.
    Everything went okay, until I tested it on my Nokia N8...
    Loading is still okay, but unloading takes more than 10 seconds.

    So, I started to search why it was so slow. I quickly figured out that creating and destroying more than 500 elements at once might be the problem...
    But now I don't know how I can solve this.

    I was thinking about using a horizontal ListView or a GridView, since they only instantiate objects as soon as they become visible.
    A gridview isn't an option, because the blocks in the schedule all have different widths (although the heights are always the same), so I was thinking about using multiple horizontal listviews for this.
    I had the idea of using several listviews underneath each other.
    To create spacing between items, I add an empty Item (with a width).
    Everything goes fine until there...
    So now I managed to design my schedule like I wanted which loads fast.

    When I scroll a listview, it only scrolls 1 listview (which is normal behaviour).
    But I want that when i scroll, that everything scrolls, like in a flickable.
    I was trying to use the Binding-element, which works fine.
    But the problem is, the number of rows are dynamic, and probably the number of Binding-objects will increase very quick.
    So I don't know if this is the right approach to solve this.

    Anyone has a better suggestion?

    (I hope my explanation of what I want and what I tried is understandable. If not, please tell me :) )



  • Hello,
    Are the 500 objects visible to user? or for example user can only see 10 items in a view and can be scroll? usually loading entire objects is not the right solution. It's better to use dynamic content methods for retrieving those few items which are needed to be display.



  • Hi,
    Well, no, not all of them are visible, only a few. That's why I've put it inside a Flickable.
    That's also why I had the idea of using a ListView, since it can load items only when needed.
    I didn't find anything about a Flickable that can load its items when needed.

    That's why I posted my question here, what the right thing to use is.
    With a ListView, the items are loaded when needed, but then I have the problem that I need to bind all the lists.
    With a Flickable, I don't need to bind, but everything is loaded immediately.



  • I think Flickable can be extend on runtime. try to write your own object with combining of javascript code and dynamic content.



  • So you suggest that I implement the dynamic loading and unloading myself?
    There's no possibility to reuse the functionality from the ListView or GridView?



  • well, you can inherit your class from QDeclarativeListView, but it can be complicated as you are not supposed to, and the class is kind of private



  • Hmm, okay, so it'll be better then to implement everything myself.
    I'm not so experienced with Qt and QML yet, so it isn't my favourite option, but if there's no other option, well then I have no choice :P

    Thanks for the comments!
    In case anybody still has an idea, I'm happy to hear it :)



  • @_Arne, did you end up implementing this? this is a lot like what I'm looking for..
    would you mind sharing your implementation? best practices?

    Thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.