[Qt-interest] Help Tree view with Dir Model

Denis Akhmetzyanov dakhmetzyanov at smartlabs.tv
Fri May 14 10:51:16 CEST 2010


Hi,
Qt Doc recommends use QFileSystemModel instead of QDirModel. The similar
topic discussed in this list:
http://lists.trolltech.com/pipermail/qt-interest/2010-March/021062.html
and
http://lists.trolltech.com/pipermail/qt-interest/2010-March/021195.html

Hope it helps.


2010/5/14 yogesh upreti <yogesh.upreti at gmail.com>

> Hello Everyone,
> I am using a tree view in my application to show the dir-structure. I am
> using the example given in Qt application:
>
> QDirModel dirModel;
> dirModel.setFilter(QDir::NoDotAndDotDot | QDir::Dirs);
> ui->tempDirView->setModel(&dirModel);
> (tempDirView is a QTreeView object)
>
> now I want to expand this tree to the current dirctory, for that, I am
> using :
>
> QString pathFileView = QDir::currentPath(); (I am getting desired value
> here)
> QModelIndex ind =  this->dirModel.index(pathFileView);
> ui->tempDirView->setExpanded(ind, true);
>
> But this is not doing anything. Also I try to print ind.row() but this
> gives me 0
>
> Do you think this is a correct way to do that or there is a better/correct
> way for this?
>
> Thanks
> Yogesh
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>


-- 
Best regards,
Denis Akhmetzyanov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100514/b71f8af6/attachment.html 


More information about the Qt-interest-old mailing list