[Qt-qml] QObjectListModel loading time
Pris Matic
prismatic.project at gmail.com
Sun Nov 13 10:32:16 CET 2011
Hi,
I was previously adding objects one-by-one... I tried updating everything
at once as you mentioned (ie. with QObjectList) and there was no delay at
all, which is awesome :)
However, doing this isn't really ideal in all cases -- for example, if I
asynchronously receive a bunch of objects I need to update the view with,
I'm stuck.
Also as an aside (but related question), is using QObjectListModel with
threading safe? Ie, am I allowed to use it outside of the main thread? If
you try to move QObjectListModel into its own thread, you need to register
the QModelIndex object as a metatype, and after doing that, things *seemed*
to work fine, but I was wondering if anyone had a concrete answer.
Regards,
Pris
On Sun, Nov 13, 2011 at 4:05 AM, Andre Somers <andre at familiesomers.nl>wrote:
> Op 13-11-2011 7:29, Pris Matic schreef:
> > Hiya,
> >
> > I've been using this class:
> > https://qt.gitorious.org/qt-labs/qml-object-model to expose a list of
> > QObject properties to a ListView. It works great until the number of
> > objects in the ListView starts going up. I have about 70 objects in my
> > list view, each with maybe 10 properties (all QStrings or ints). My
> > delegate isn't complicated, and ListView performance (ie. scrolling)
> > is fluid. The issue is it takes forever for the ListView to load in
> > the first place... upwards of 6-7 seconds on my dual core PC. This
> > doesn't occur if you expose the data to the ListView through
> > QVariant... in that case the data shows up almost immediately. Once
> > the data is loaded, everything runs great. It also loads fine when
> > there are less than 10-15 items. Has anyone else experienced this when
> > using a Qaim based model with ListView in QML? Are there any workarounds?
> >
> How do you add the QObjects to the QObjectListModel? Do you do that
> object-by-object, or do you set the whole list in one go using a
> QObjectList?
>
> André
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20111113/e7eb17e2/attachment.html
More information about the Qt-qml
mailing list