[Qt-interest] QDirModel v. QFileSystemModel ?
Stephen Collyer
scollyer at netspinner.co.uk
Mon Jun 15 10:59:46 CEST 2009
2009/6/12 Stephen Collyer <scollyer at netspinner.co.uk>
> 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).
>
> I need to be able to:
>
> a) display the contents of a particular directory in a treeview or listview
I'm now stumbling over this little problem: how do I convince a
QTreeView/QFileSystemModel to display the contents of a particular
subdirectory only ?
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.
Any suggestions ?
--
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090615/0d5ce98a/attachment.html
More information about the Qt-interest-old
mailing list