Implement asynchronous QAbstractItemModel
ocgltd last edited by
I am implementing an QAbstractItemModel which fetches data asynchronously over a slow connection. From what I read the methods in QAbstractItemModel should return a response immediately, which can be overwritten later. So I built a simple QAbstractItemModel overriding only rowcount and data.
My algorithm is:
- Upon rowCount() called return cached value or 0 if never fetched before
- Fetch rowCount from remote slow database
- Upon receipt of response issue beginInsertRows and endInsertRows
That works, but the data method is never called. So my 3 items in the view are empty. Why is 'data' not called for each item?
mzimmers last edited by
@ocgltd if you put together a few lines of representative code, you're much more likely to get answers here.
Also: are you sure you wanted to post this in the QML forum?
Closing this one