>> 1) quickly calculate/get the total number of items and return that value >> from rowCount() to let views properly configure their scroll bars; > is that a method one overrides? where is "rowCount()" defined? > do i override it by subclassing QSortFilterProxyModel? Yes, it's one of the pure virtual methods of QAbstractItemModel. And I was talking about rowCount() in the model which is behind QSortFilterProxyModel and/or other proxies.
>> 2) load data in the background; > i think this is already happening > >> 3) return some placeholder values from data() for items that have not been >> loaded yet; >> 4) when a new batch of items is available, add it to the model's internal >> storage and emit the dataChanged() signal with appropriate index range. > wouldn't the view ask the model for whatever data is revealed as visible, all > by itself? > so no need to show mock data? the point is i want to show the real data, even > if the user jumps to the last rows immediately > > do i *need* to manually do this? Yes, views ask only about visible items, but not all visible items may have real data, especially if whatever provides that data is slow. So, if the now-loaded items are visible in some views, dataChanged() will update these views, otherwise nothing will happen. Without the dataChanged() signal views may never replace mock data with real one. If the user scrolls to items without real data, you should show at least something — empty rows are ambiguous/confusing ("not-yet-loaded items?", "items with empty data?", "bug?"). > thanks for the suggestions, i'm trying to understand > > -dave
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest