[Qt-interest] How to use QFileSystemModel

birman birman at mac.com
Sun Feb 28 14:39:55 CET 2010


Hi, All.

I'm trying to develop "File Browser" using QFileSystemModel as below.

FileBrowser::FileBrowser(QWidget *parent) : QListView(parent)
{
	fsysModel = new QFileSystemModel;
	fsysModel->setFilter(QDir::AllEntries);
	
	setModel(fsysModel);
	QModelIndex cwdIndex = fsysModel->index(QDir::homePath());
	
	setRootIndex(cwdIndex);
}

But, All entries were not displayed (only one dir was displayed in QListView).

When I changed QFileSystemModel to QDirModel,
All entries were displayed including dot and dotdot dir.

Please tell me how to display all entries  including dot and dotdot dir using QFileSystemModel in QListView.

Qt version : 4.6.2

With best regards,
Birman



More information about the Qt-interest-old mailing list