Hi,
I also want to add custom row to QFileSystemModel. This newly added row will be having only some string e.g. "MyFiles" and when I click on this row, it will show files in some predefined folder.
Below is the non working code where I am trying to add row to existing QFileSystemModel:
I would appreciate any help with example , thanks.
MyFileSystemModel::MyFileSystemModel(QObject *parent)
: QFileSystemModel(parent)
{
this->setRootPath("C:/");
//Lets wait to get model filled
QTimer::singleShot(1000,this,SLOT(addFirstRow()));
}
void MyFileSystemModel::addFirstRow()
{
QString local("LOCAL");
this->insertRow(0);
this->setData(this->index(0,0),local,Qt::DisplayRole);
}
Bookmarks