[Qt-interest] QAbstractItemModel::canFetchMore/fetchMore and view->selectAll

Scott Aron Bloom Scott.Bloom at sabgroup.com
Tue Jun 23 19:20:23 CEST 2009


> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Girish Ramakrishnan
> Sent: Monday, June 22, 2009 10:20 PM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QAbstractItemModel::canFetchMore/fetchMore
and
> view->selectAll
> 
> Scott Aron Bloom wrote:
> > Does anyone else consider this a bug?
> >
> 
> I think the current behavior is correct. selectAll is just a shortcut
to
> 'select all indices' and not 'select all indices that will ever
appear'.
> 
> If we had the behavior your way (which is not wrong), you will have
all
> sorts of complications like when should the view stop following the
> indices in the model and aggressively selecting them. What If I don't
> actually want to select the new ones that have just been fetched? What
> happens when model was cleared and new items are added. And so on.
> 
> On a side note, your code won't work, if fetchMore does not fetch
items
> immediately.
> 
> Girish

-----

Good points... However, the doc for selectAll says "selects all item
(sic) in the view"

Now I see what your saying, if it hasn't been fetched, its not in the
view :)

Another gotcha, if the model does not have the ability to determine the
total row count (very common in SQL since not all sql servers return the
row count) you cant even do a "create a phantom ish index" and select
from 0 to max.

I wondering if an extension is needed to do this...

Your points are well taken, though the documentation is clearly abstract
on this issue :)

Scott




More information about the Qt-interest-old mailing list