[Qt-interest] QTreeView::expandAll() bug ?

Stephen Collyer scollyer at netspinner.co.uk
Fri Jun 19 19:54:59 CEST 2009


2009/6/19 Benjamin Meyer <ben at meyerhome.net>

>
> On Jun 19, 2009, at 5:53 AM, Stephen Collyer wrote:
>
>  I have a QTreeView displaying a subset of a QFileSystemModel
>> which looks like, say:
>>
>> level_1/a_file
>> level_1/b_file
>> level_1/level_2
>> level_1/level_2/c_file
>> level_1/level_2/level_3
>> level_1/level_2/level_3/d_file
>>
>> When I call QTreeView::expandAll(), the level_3 directory is not displayed
>> as expanded in the view, though level_2 is displayed as expanded.
>>
>> Is this a bug ?
>>
>> --
>> Stephen Collyer
>>
>
> Maybe not the best api, but it is behaving correct.  expandAll is a one
> time operation to expand everything it currently has.  QFileSytemModel
> doesn't know about level_3 until some time after level_2 is opened (being
> lazily populated).  You probably want a keepAllExpanded() function.  An
> alternative is to use QDirModel which will load level_3 as soon as level_2
> is opened (if level_3 is big this can stale the ui of course).
>

[please reply to the list, not to me]

Yes, I think that you're right. The problem is probably with the
lazy-fetching
model. I'm trying to implement a "select all items" method, too, and I
suspect
that this is causing problems there as well. I'm trying to use fetchMore()
to
populate the model as I walk the dir tree, but it doesn't seem to be doing
so,
for some reason.

I'm not finding the model/view classes nearly as easy to use as I'd
expected.

-- 
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090619/65bfe2c5/attachment.html 


More information about the Qt-interest-old mailing list