I need to traverse my drives in system and display only .mp3 and .avi files. basically set the filter to these extensions and display the files in a treeview.
QString sPath
= m_SystemModel
->fileInfo
(index
).
absoluteFilePath();
ui->DriveListView->setRootIndex(m_SystemListViewModel->setRootPath(sPath));
sDriveFilters << "*.aac" << "*.wmv" << "*.avi" << "*.mpeg" << "*.mov" << "*.3gp" << "*.flv" << "*.mp3" ;
m_SystemModel
->setRootPath
(QDir::currentPath());
m_SystemModel
->setFilter
(QDir::NoDotAndDotDot |
QDir::AllDirs );
m_SystemListViewModel
->setFilter
( QDir::Files |
QDir::AllDirs |
QDir::NoDotAndDotDot );
m_SystemListViewModel->setNameFilters(sDriveFilters);
m_SystemListViewModel->setNameFilterDisables(false);
QStringList sDriveFilters;
QString sPath = m_SystemModel->fileInfo(index).absoluteFilePath();
ui->DriveListView->setRootIndex(m_SystemListViewModel->setRootPath(sPath));
sDriveFilters << "*.aac" << "*.wmv" << "*.avi" << "*.mpeg" << "*.mov" << "*.3gp" << "*.flv" << "*.mp3" ;
m_SystemModel->setRootPath(QDir::currentPath());
m_SystemModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs );
m_SystemListViewModel->setFilter( QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot );
m_SystemListViewModel->setNameFilters(sDriveFilters);
m_SystemListViewModel->setNameFilterDisables(false);
To copy to clipboard, switch view to plain text mode
If you notice I have set filter as
setFilter
( QDir::Files |
QDir::AllDirs |
QDir::NoDotAndDotDot )
setFilter( QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot )
To copy to clipboard, switch view to plain text mode
and setNameFilters to sDriveFilters. This displays all the directories in my treeview. Ideally I want it to display only audio/video files.
Bookmarks