[Qt-interest] QDirModel v. QFileSystemModel ?

Stephen Collyer scollyer at netspinner.co.uk
Mon Jun 15 11:41:04 CEST 2009


2009/6/15 Stephen Collyer <scollyer at netspinner.co.uk>

>
> QFileSystemModel::setRootPath() doesn't do this, though it does return
> a QModelIndex, which I've tried using in the view as the root index, like
> so:
>
>     dir_model_ = new QFileSystemModel(this);
>     QModelIndex root_index = dir_model_->setRootPath(<some path>);
>
>     files_tree->setModel(dir_model_);
>     files_tree->setRootIndex(root_index);
>
> When I try this, the view displays nothing at all - I don't know why.
>

I now understand. It displays nothing because there was nothing in the
directory at the time I tried. This approach seems to work fine.

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


More information about the Qt-interest-old mailing list