[Qt-interest] Model/View delayed loading for large datasets

Jugdish jugdizh at gmail.com
Mon Feb 1 16:14:49 CET 2010


I have experimented with canFetchMore() + fetchMore(), but it seems the way
these behave is to continually append more and more data as you scroll down,
with the scrollbars constantly resizing themselves to reflect to change in
row count. In contrast, the behavior I'm after is to have the scrollbars
sized correctly at the outset, based on the total number of rows that there
*will be*, and fetch the data as the user scrolls around in the viewport.
This would allow the user to quickly jump to the end of the results without
having to incrementally fetch every single row on the way down. Does this
make sense?
Thanks

On Mon, Feb 1, 2010 at 3:09 PM, Andre Somers <andre at familiesomers.nl> wrote:

> Jugdish wrote:
> > I'm using Qt's model/view framework to implement a tabular display of
> > data fetched from an SQL database. The dataset is large enough that it
> > is not practical to populate the table with all the data at once. At
> > the same time, I'd like to avoid the use of pagination to break up the
> > results into pages (end-users have expressed a distaste for this
> > method of navigating through the data).
> >
> > So I'd like to implement an efficient method of loading the data
> > incrementally so that only the data currently visible in the viewport
> > is actually fetched from the database. First, the total item count
> > would be determined from the database. The viewport's scrollbars would
> > be sized based on this number, but the actual data (and model indexes)
> > would not be loaded until the user scrolls to a particular offset in
> > the viewport. What I'm wondering is if this idea is even possible
> > using Qt's model/view framework.
> >
> > Thank you!
>
> Yes, you can do this!
> Take a look at QAbstractItemModel::canFetchMore and ::fetchMore.
>
> André
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100201/3d43d900/attachment.html 


More information about the Qt-interest-old mailing list