[Qt-qml] ListView crashes with more than 256 delegate elements.
Yuvraaj Kelkar
yuvraaj at gmail.com
Tue Jan 4 17:14:28 CET 2011
I found a workaround - so I'm not sure if it is still a bug.
The work around was:
while (model->canFetchMore()) { model->fetchMore(); }
The problem (at least what I could figure out) was that the QML list
view expected the data to be cached and attempted to access it even
when it wasn't. The fetchmore loop makes sure that the data is cached.
Now it might very well be that this is still a bug in that I had to
force fill the entire cache whereas the reason for the fetchmore
methods is incremental fillups.
If you think that is a bug then I'll file it.
On Mon, Jan 3, 2011 at 11:47 PM, <martin.jones at nokia.com> wrote:
> This is related to http://bugreports.qt.nokia.com/browse/QTBUG-16039, but it would be good if you could create a new bug report with an example which reproduces your use case.
>
> Br,
> Martin.
>
>> -----Original Message-----
>> From: qt-qml-bounces+martin.jones=nokia.com at qt.nokia.com [mailto:qt-qml-
>> bounces+martin.jones=nokia.com at qt.nokia.com] On Behalf Of ext Yuvraaj Kelkar
>> Sent: Tuesday, 4 January 2011 2:36 AM
>> To: qt-qml at qt.nokia.com
>> Subject: Re: [Qt-qml] ListView crashes with more than 256 delegate elements.
>>
>> Posting the solution to fix this problem:
>>
>> > I have a QML List View here:
>> >
>> http://code.google.com/p/qgvdial/source/browse/branches/contactsui/qml/Contacts
>> List.qml?r=285
>> > This list shows contacts from a model which I derive from QSqlQueryModel.
>> > There are about 800 contacts in the table.
>> >
>> > When I scroll down the contacts list, at the point where QML is
>> > loading the 256th delegate, it spews the output:
>> > "
>> > QDeclarativeComponent: Cannot create new component instance before
>> > completing the previous
>> > <Unknown File>: QML VisualDataModel: Error creating delgate
>> > qrc:/ContactsList.qml:105:13: QML Text: Binding loop detected for
>> > property "text"
>> > qrc:/ContactsList.qml:95:32767: QML Component: Delegate component must
>> > be Item type.
>> > "
>> >
>> > And then it segfaults.
>> >
>> > If I use qmlviewer with a test ListModel with >1000 contacts, it
>> > works, but my code does not.
>> > I think this may be a QML bug, but I am not sure.
>> > Any help is appreciated.
>>
>> The solution is to add
>> while (model->canFetchMore()) { model->fetchMore(); }
>> after telling the QML view about the model.
>>
>> The QML ListView was attempting to access the next cached model index.
>> Since only the first 256 entries had been indexed, the 257th attempt
>> consistently segfaulted.
>> With the canFetch,fetchMore loop, the cache is entirely populated and
>> all is well.
>> _______________________________________________
>> Qt-qml mailing list
>> Qt-qml at qt.nokia.com
>> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>
More information about the Qt-qml
mailing list