Changeset 846 for trunk/src/gui/itemviews/qdirmodel.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/itemviews/qdirmodel.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 186 186 /*! 187 187 \class QDirModel 188 188 \obsolete 189 189 \brief The QDirModel class provides a data model for the local filesystem. 190 190 191 191 \ingroup model-view 192 192 193 \noteThe usage of QDirModel is not recommended anymore. The193 The usage of QDirModel is not recommended anymore. The 194 194 QFileSystemModel class is a more performant alternative. 195 195 … … 201 201 QDirModel keeps a cache with file information. The cache needs to be 202 202 updated with refresh(). 203 204 A directory model that displays the contents of a default directory205 is usually constructed with a parent object:206 207 \snippet doc/src/snippets/shareddirmodel/main.cpp 2208 209 A tree view can be used to display the contents of the model210 211 \snippet doc/src/snippets/shareddirmodel/main.cpp 4212 213 and the contents of a particular directory can be displayed by214 setting the tree view's root index:215 216 \snippet doc/src/snippets/shareddirmodel/main.cpp 7217 218 The view's root index can be used to control how much of a219 hierarchical model is displayed. QDirModel provides a convenience220 function that returns a suitable model index for a path to a221 directory within the model.222 203 223 204 QDirModel can be accessed using the standard interface provided by … … 1183 1164 void QDirModelPrivate::init() 1184 1165 { 1166 Q_Q(QDirModel); 1185 1167 filters = QDir::AllEntries | QDir::NoDotAndDotDot; 1186 1168 sort = QDir::Name; … … 1189 1171 root.info = QFileInfo(); 1190 1172 clear(&root); 1173 QHash<int, QByteArray> roles = q->roleNames(); 1174 roles.insertMulti(QDirModel::FileIconRole, "fileIcon"); // == Qt::decoration 1175 roles.insert(QDirModel::FilePathRole, "filePath"); 1176 roles.insert(QDirModel::FileNameRole, "fileName"); 1177 q->setRoleNames(roles); 1191 1178 } 1192 1179
Note:
See TracChangeset
for help on using the changeset viewer.