PDA

View Full Version : filesysteme avec Qt



chochatown
20th June 2009, 01:31
hello ,
i have to change from wxwidget to qt ,the problem is that i cant find a remplacement of wxfilesysteme in qt.

that's my code:




{
QString wildCard = "";
QString fileName = "";

lstFolderFiles->clear();

fileSystem->ChangePathTo( txtFolderSource->GetValue(), true );

for( int i = 1, j = 0; i < formatsCount; i ++ )
{
wildCard += wxT( "*." ) + formats[ i ][ 1 ];

fileName = fileSystem->FindFirst( wildCard, wxFILE );

if( fileName != wxEmptyString )
{
do
{
lstFolderFiles->AppendAndEnsureVisible( fileName );

if( radAllFolderSourceFiles->GetValue() )
{
lstFolderFiles->Check( j ++ );
}
}
while( ( fileName = fileSystem->FindNext() ) != wxEmptyString );
}

wildCard = "";
}
}




thanks

wysota
20th June 2009, 02:30
You mean QDir?

chochatown
20th June 2009, 07:33
no i mean diriterator i just finish replacing it
that's the new code :)



QStringList listFilter;
QString filter;

QListWidgetItem *fileName;

lstFolderFiles->clear();


for( int i = 1; i < formatsCount; i ++ )
{
filter=QString( "*." ) + formats[ i ][ 1 ];

listFilter << filter;
}
QDirIterator dirIterator(txtFolderSource->text(), listFilter ,QDir::Files | QDir::NoSymLinks, QDirIterator::Subdirectories);// Path Initialisation

while(dirIterator.hasNext())
{
fileName= new QListWidgetItem (dirIterator.next());
filter=dirIterator.next();
fileName->setCheckState(Qt::Checked);
if( radAllFolderSourceFiles->isChecked() )
{
fileName->setCheckState(Qt::Checked);
}
lstFolderFiles->addItem( fileName );
}



thank you

wysota
20th June 2009, 10:20
How about using QTreeView and QFileSystemModel instead?