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: [email protected] [mailto:qt-qml- > [email protected]] On Behalf Of ext Yuvraaj Kelkar > Sent: Tuesday, 4 January 2011 2:36 AM > To: [email protected] > 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 > [email protected] > http://lists.qt.nokia.com/mailman/listinfo/qt-qml _______________________________________________ Qt-qml mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-qml
