equal
deleted
inserted
replaced
183 } |
183 } |
184 } |
184 } |
185 |
185 |
186 /*! |
186 /*! |
187 \class QDirModel |
187 \class QDirModel |
188 |
188 \obsolete |
189 \brief The QDirModel class provides a data model for the local filesystem. |
189 \brief The QDirModel class provides a data model for the local filesystem. |
190 |
190 |
191 \ingroup model-view |
191 \ingroup model-view |
192 |
192 |
193 \note The usage of QDirModel is not recommended anymore. The |
193 The usage of QDirModel is not recommended anymore. The |
194 QFileSystemModel class is a more performant alternative. |
194 QFileSystemModel class is a more performant alternative. |
195 |
195 |
196 This class provides access to the local filesystem, providing functions |
196 This class provides access to the local filesystem, providing functions |
197 for renaming and removing files and directories, and for creating new |
197 for renaming and removing files and directories, and for creating new |
198 directories. In the simplest case, it can be used with a suitable display |
198 directories. In the simplest case, it can be used with a suitable display |
1180 The root node is never seen outside the model. |
1180 The root node is never seen outside the model. |
1181 */ |
1181 */ |
1182 |
1182 |
1183 void QDirModelPrivate::init() |
1183 void QDirModelPrivate::init() |
1184 { |
1184 { |
|
1185 Q_Q(QDirModel); |
1185 filters = QDir::AllEntries | QDir::NoDotAndDotDot; |
1186 filters = QDir::AllEntries | QDir::NoDotAndDotDot; |
1186 sort = QDir::Name; |
1187 sort = QDir::Name; |
1187 nameFilters << QLatin1String("*"); |
1188 nameFilters << QLatin1String("*"); |
1188 root.parent = 0; |
1189 root.parent = 0; |
1189 root.info = QFileInfo(); |
1190 root.info = QFileInfo(); |
1190 clear(&root); |
1191 clear(&root); |
|
1192 QHash<int, QByteArray> roles = q->roleNames(); |
|
1193 roles.insertMulti(QDirModel::FileIconRole, "fileIcon"); // == Qt::decoration |
|
1194 roles.insert(QDirModel::FilePathRole, "filePath"); |
|
1195 roles.insert(QDirModel::FileNameRole, "fileName"); |
|
1196 q->setRoleNames(roles); |
1191 } |
1197 } |
1192 |
1198 |
1193 QDirModelPrivate::QDirNode *QDirModelPrivate::node(int row, QDirNode *parent) const |
1199 QDirModelPrivate::QDirNode *QDirModelPrivate::node(int row, QDirNode *parent) const |
1194 { |
1200 { |
1195 if (row < 0) |
1201 if (row < 0) |