diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-10-15 07:09:38 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-10-15 07:09:38 (GMT) |
commit | 7cc04115db6f9fa2d79d02d32cff38e4ecd8c52b (patch) | |
tree | 7fb17d1a2085b61c116a6c0ee3d7f41fbd60dda2 /src/declarative/extra | |
parent | 343535d7cbae16c02517664ce0d363e9834bd74d (diff) | |
download | Qt-7cc04115db6f9fa2d79d02d32cff38e4ecd8c52b.zip Qt-7cc04115db6f9fa2d79d02d32cff38e4ecd8c52b.tar.gz Qt-7cc04115db6f9fa2d79d02d32cff38e4ecd8c52b.tar.bz2 |
Some improvements to loader
Diffstat (limited to 'src/declarative/extra')
-rw-r--r-- | src/declarative/extra/qmlfolderlistmodel.cpp | 9 | ||||
-rw-r--r-- | src/declarative/extra/qmlfolderlistmodel.h | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/declarative/extra/qmlfolderlistmodel.cpp b/src/declarative/extra/qmlfolderlistmodel.cpp index bdea03f..4a7c2f1 100644 --- a/src/declarative/extra/qmlfolderlistmodel.cpp +++ b/src/declarative/extra/qmlfolderlistmodel.cpp @@ -195,6 +195,15 @@ void QmlFolderListModel::setFolder(const QString &folder) } } +QString QmlFolderListModel::parentFolder() const +{ + Q_D(const QmlFolderListModel); + int pos = d->folder.lastIndexOf('/'); + if (pos == -1) + return QString(); + return d->folder.left(pos); +} + /*! \qmlproperty list<string> FolderListModel::nameFilters diff --git a/src/declarative/extra/qmlfolderlistmodel.h b/src/declarative/extra/qmlfolderlistmodel.h index 24a3ac6..6bb1c4b 100644 --- a/src/declarative/extra/qmlfolderlistmodel.h +++ b/src/declarative/extra/qmlfolderlistmodel.h @@ -61,6 +61,7 @@ class Q_DECLARATIVE_EXPORT QmlFolderListModel : public QListModelInterface, publ Q_INTERFACES(QmlParserStatus) Q_PROPERTY(QString folder READ folder WRITE setFolder NOTIFY folderChanged) + Q_PROPERTY(QString parentFolder READ parentFolder NOTIFY folderChanged) Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters) Q_PROPERTY(SortField sortField READ sortField WRITE setSortField) Q_PROPERTY(bool sortReversed READ sortReversed WRITE setSortReversed) @@ -77,6 +78,8 @@ public: QString folder() const; void setFolder(const QString &folder); + QString parentFolder() const; + QStringList nameFilters() const; void setNameFilters(const QStringList &filters); |