[Qt-interest] QDir::entryInfoList problems
Guido Seifert
Wargand at gmx.de
Thu May 20 17:02:54 CEST 2010
QDir QFileInfo::dir () const
Returns the path of the object's parent directory as a QDir object.
Note: The QDir returned always corresponds to the object's parent directory, even if the QFileInfo represents a directory.
For each of the follwing, dir() returns a QDir for "~/examples/191697".
QFileInfo fileInfo1("~/examples/191697/.");
QFileInfo fileInfo2("~/examples/191697/..");
QFileInfo fileInfo3("~/examples/191697/main.cpp");
Guido
-------- Original-Nachricht --------
> Datum: Thu, 20 May 2010 14:35:43 +0200
> Von: Riccardo Roasio <riccardo.roasio at gmail.com>
> An: qt-interest <qt-interest at trolltech.com>
> Betreff: [Qt-interest] QDir::entryInfoList problems
> Hi,
>
> i have some problems with QDir::entryInfoList. It is not working for me.
> Here is the code:
>
> QDir d=QDir(dir.absolutePath()+"/Cache");
> std::cout<<"DIR: "<<d.absolutePath().toStdString()<<std::endl;
> QFileInfoList list=d.entryInfoList(QDir::AllDirs, QDir::DirsFirst);
> std::cout<<list.count()<<std::endl;
> for (int i = 0; i < list.count(); i++)
> {
> if(list.at(i).isDir())
> {std::cout<<list.at(i).dir().dirName().toStdString()<<std::endl;}
> else
> {std::cout<<list.at(i).fileName().toStdString()<<std::endl;}
> }
>
> and here is the result:
>
> DIR: /home/citec/development/Qt/NWMInstaller/Cache
> 3
> Cache
> Cache
> Cache
>
>
> It gives me Cache three times while in the Cache dir there are 1
> directory WTB and 1 file asd
>
> Why this happens?
>
> Thanks,
> Riccardo
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
More information about the Qt-interest-old
mailing list