diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-07-26 11:52:06 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-07-26 11:52:32 +0200 |
commit | 993bc84f49b4922480f6ec566f31c24465f0e005 (patch) | |
tree | 5189edc8e2e0942459d09a4765ad17dd681fe801 /src/imports/folderlistmodel | |
parent | 713a4c5b1d601f57d538fdbb1e8f6bc05ce07275 (diff) | |
parent | 84871192077c18bb093c6259339200bd22d64f00 (diff) |
Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into merge
Change-Id: I5824a3eb624b325de10acfd5109c4c1bdabcf780
Diffstat (limited to 'src/imports/folderlistmodel')
-rw-r--r-- | src/imports/folderlistmodel/qquickfolderlistmodel.cpp | 10 | ||||
-rw-r--r-- | src/imports/folderlistmodel/qquickfolderlistmodel.h | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp index 4dbbcf359d..2f9c07cf20 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp @@ -325,6 +325,7 @@ QQuickFolderListModel::QQuickFolderListModel(QObject *parent) d->roleNames[FileLastModifiedRole] = "fileModified"; d->roleNames[FileLastReadRole] = "fileAccessed"; d->roleNames[FileIsDirRole] = "fileIsDir"; + d->roleNames[FileUrlRole] = "fileURL"; d->init(); } @@ -366,6 +367,9 @@ QVariant QQuickFolderListModel::data(const QModelIndex &index, int role) const case FileIsDirRole: rv = d->data.at(index.row()).isDir(); break; + case FileUrlRole: + rv = QUrl::fromLocalFile(d->data.at(index.row()).filePath()); + break; default: break; } @@ -402,8 +406,7 @@ QModelIndex QQuickFolderListModel::index(int row, int , const QModelIndex &) con The \a folder property holds a URL for the folder that the model is currently providing. - The value is a URL expressed as a string, and must be a \c file: or \c qrc: - URL, or a relative URL. + The value must be a \c file: or \c qrc: URL, or a relative URL. By default, the value is an invalid URL. */ @@ -443,7 +446,7 @@ void QQuickFolderListModel::setFolder(const QUrl &folder) /*! - \qmlproperty string QQuickFolderListModel::rootFolder + \qmlproperty url QQuickFolderListModel::rootFolder When the rootFolder is set, then this folder will be threated as the root in the file system, so that @@ -753,6 +756,7 @@ void QQuickFolderListModel::setShowOnlyReadable(bool on) \list \li \c fileName \li \c filePath + \li \c fileURL \li \c fileBaseName \li \c fileSuffix \li \c fileSize diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.h b/src/imports/folderlistmodel/qquickfolderlistmodel.h index 43af77adf5..68541f1735 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.h +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.h @@ -90,7 +90,8 @@ public: FileSizeRole = Qt::UserRole + 5, FileLastModifiedRole = Qt::UserRole + 6, FileLastReadRole = Qt::UserRole +7, - FileIsDirRole = Qt::UserRole + 8 + FileIsDirRole = Qt::UserRole + 8, + FileUrlRole = Qt::UserRole + 9 }; virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; |