[Qt-interest] QFileSystemModel and QTreeView interesting problemH
Andrei Sebastian Cimpean
andreiamenta at gmail.com
Mon Mar 29 10:18:45 CEST 2010
Hello again.
I tried your approach but got a similar result to the first problem, as seen in
the screenshot.
I've attached another one also.
Any ideas?
Thanks!
On Friday 26 March 2010 19:13:57 you wrote:
> Hi,
> QFileSystemModel::setRootPath doesn't scroll view to target path. Try this
> code:
>
> m_treeModel = new QFileSystemModel(this);
> m_treeView = new QTreeView(this);
> m_treeView->setModel(m_treeModel);
> QModelIndex index = m_treeModel->setRootPath(QDir::homePath());
> m_treeView->scrollTo(index);
> m_treeModel->setFilter(QDir::AllDirs
>
> |QDir::AllEntries|QDir::System|QDir::Hidden|QDir::NoDotAndDotDot);
>
> m_treeModel->setReadOnly(true);
>
>
> 2010/3/26 Andrei Cimpean <andreiamenta at gmail.com>
>
> > Hello everybody.
> >
> > I am trying to display folders in a tree with this code:
> > treeModel = new QFileSystemModel;
> > m_ui->treeView->setModel(treeModel);
> > treeModel->setRootPath(QDir::homePath());//this displays /Users/andrei
> > treeModel->setFilter(QDir::AllDirs
> > |
> > |QDir::AllEntries|QDir::System|QDir::Hidden|QDir::NoDotAndDotDot);
> > |
> > treeModel->setReadOnly(true);
> >
> > , but the result is:
> >
> >
> > .
> >
> > Any ideas ?
> > Thanks in advance.
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snapshot12.png
Type: image/png
Size: 13487 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100329/f7f80972/attachment.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100329/f7f80972/attachment.bin
More information about the Qt-interest-old
mailing list