Added filter to QFileSystemModel fmodel
Setup some comments regarding a setFilter part Edited getAssetLibrary to pass arguments to setAsset -- Note will be used for dropdown interaction. Set a temp path for testing purposes.
This commit is contained in:
parent
7a41f2d9bf
commit
031c620f52
|
@ -41,6 +41,14 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
// set default text to file info
|
// set default text to file info
|
||||||
m_fileInfo = "Filename: -\nMaterials: -\nVertices: -\nTriangle: -<detail>No file is open";
|
m_fileInfo = "Filename: -\nMaterials: -\nVertices: -\nTriangle: -<detail>No file is open";
|
||||||
|
|
||||||
|
|
||||||
|
filters << "*.msh" << "*.MSH" << "*.mesh" << "*.MESH" << "*/";
|
||||||
|
fmodel = new QFileSystemModel(this);
|
||||||
|
fmodel->setNameFilters(filters);
|
||||||
|
// fmodel->setFilter(QDir::NoDotAndDotDot | QDir::Files); // Need to get a way to scan dirs recursivly for mush files
|
||||||
|
// maybe add it to a qstringlist and then set it as a model.
|
||||||
|
fmodel->setNameFilterDisables(false);
|
||||||
|
|
||||||
// add widgets to the window
|
// add widgets to the window
|
||||||
setupWidgets();
|
setupWidgets();
|
||||||
|
|
||||||
|
@ -165,12 +173,16 @@ void MainWindow::setupWidgets()
|
||||||
|
|
||||||
void MainWindow::getAssetLibrary()
|
void MainWindow::getAssetLibrary()
|
||||||
{
|
{
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem;
|
QString path;
|
||||||
item->setData(0, Qt::DisplayRole, "Wuhu");
|
path = "C:/BF2_ModTools/data_MAX/Worlds/MAX/msh"; // temp path setting
|
||||||
ui->treeWidget->addTopLevelItem(item);
|
setAsset(path);
|
||||||
|
}
|
||||||
searchMeshFiles("D:/workspaces/Visual Studio 2015/Projects/OpenGL/Release");
|
|
||||||
|
|
||||||
|
void MainWindow::setAsset(QString path)
|
||||||
|
{
|
||||||
|
fmodel->setRootPath(path);
|
||||||
|
ui->fileListView->setModel(fmodel);
|
||||||
|
ui->fileListView->setRootIndex(fmodel->index(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::searchMeshFiles(QString path)
|
void MainWindow::searchMeshFiles(QString path)
|
||||||
|
|
Loading…
Reference in New Issue