[Qt-interest] QDirModel v. QFileSystemModel ?
Stephen Collyer
scollyer at netspinner.co.uk
Sat Jun 13 12:58:29 CEST 2009
2009/6/13 Girish Ramakrishnan <girish at forwardbias.in>
> Stephen Collyer wrote:
> > Could someone explain the relative merits/demerits of these two models ?
> > The docs don't make it clear to me when one should be preferred over the
> > other (apart from the separate thread thing with QFileSystemModel).
> >
>
> QFileSystemModel is like the successor to QDirModel.
Does this imply that QDirModel is deprecated, or likely to be ?
> Main advantage is
> that it populates the model in a thread unlike QDirModel which does it
> in the UI thread. As a consequence, one cannot arbitrarily query
> information in a QFileSystemModel because the data may not be available
> yet (unlike a QDirModel which will perform the operation synchronously).
> In practice, this is not a problem when displaying the model in a view.
>
Presumably the view triggers the model to load the required portion
of the file system at the appropriate time ?
> Right. If you want to just display portion of the file system using
> QDirModel, one can use the view's setRootIndex.
>
OK, thanks for the info.
--
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090613/9993c10f/attachment.html
More information about the Qt-interest-old
mailing list