summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-03-22 04:09:20 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-03-22 04:09:20 (GMT)
commitc1958338bb94f045c846147bdb7224377a2122a6 (patch)
treebab76e1baed0fcc5f49697378c9d5e07bdec0b42 /src/gui/itemviews
parent44660e6d34ce969069a82fe26f5e4b13d4d5ec78 (diff)
downloadQt-c1958338bb94f045c846147bdb7224377a2122a6.zip
Qt-c1958338bb94f045c846147bdb7224377a2122a6.tar.gz
Qt-c1958338bb94f045c846147bdb7224377a2122a6.tar.bz2
Set role names for QFileSystemModel and QDirModel
Task-number: QTBUG-7479 Reviewed-by: Alexis Menard
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qdirmodel.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/gui/itemviews/qdirmodel.cpp
index 378a238..48599bc 100644
--- a/src/gui/itemviews/qdirmodel.cpp
+++ b/src/gui/itemviews/qdirmodel.cpp
@@ -1182,12 +1182,18 @@ QFileInfo QDirModel::fileInfo(const QModelIndex &index) const
void QDirModelPrivate::init()
{
+ Q_Q(QDirModel);
filters = QDir::AllEntries | QDir::NoDotAndDotDot;
sort = QDir::Name;
nameFilters << QLatin1String("*");
root.parent = 0;
root.info = QFileInfo();
clear(&root);
+ QHash<int, QByteArray> roles = q->roleNames();
+ roles.insertMulti(QDirModel::FileIconRole, "fileIcon"); // == Qt::decoration
+ roles.insert(QDirModel::FilePathRole, "filePath");
+ roles.insert(QDirModel::FileNameRole, "fileName");
+ q->setRoleNames(roles);
}
QDirModelPrivate::QDirNode *QDirModelPrivate::node(int row, QDirNode *parent) const