[SOLVED] Hide inactive files QTreeView



  • Hello guys. I know this is a very discussed problem in internet, but i've tried a lot without success. Here follows my code:

    @dirmodel = new QFileSystemModel(this);

    QStringList filters;
    filters << "*.xml";
    dirmodel->setNameFilters(filters);
    
    this->ui->treeView->setModel(dirmodel);
    this->ui->treeView->setColumnHidden(1, true);
    this->ui->treeView->setColumnHidden(2, true);
    this->ui->treeView->setColumnHidden(3, true);
    
    this->ui->treeView->setRootIndex(
                dirmodel->setRootPath(
                    this->workspacepath
                    )
                );@
    

    This code was created to show only .xml files in QTreeView. But it only set other extensions as inactive (like image below). How do i hide all this inactive files?

    !https://dl.dropboxusercontent.com/u/45191488/2.png(image)!



  • Look at the QFileSystemModel::setNameFilterDisables()



  • It works. Thank you. :)

    [quote author="ChrisW67" date="1372146434"]Look at the QFileSystemModel::setNameFilterDisables()[/quote]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.