summaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-05-19 07:10:14 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-05-19 07:10:14 (GMT)
commitd395903e4d061a30117f7b925bdad41771a29067 (patch)
treee7e2e2d09afc77af51197f5d4954249b21ee9a44 /src/imports
parent8238ef5d6648ca8fde2c709d6125772cac6a11a5 (diff)
parentf5588a2177452de29804e67ae8cd45c50f6dfdba (diff)
downloadQt-d395903e4d061a30117f7b925bdad41771a29067.zip
Qt-d395903e4d061a30117f7b925bdad41771a29067.tar.gz
Qt-d395903e4d061a30117f7b925bdad41771a29067.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Conflicts: doc/src/snippets/declarative/listview/highlight.qml doc/src/snippets/declarative/listview/listview.qml
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/folderlistmodel/plugin.cpp4
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp12
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.h41
3 files changed, 52 insertions, 5 deletions
diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp
index b94efb0..d4569f7 100644
--- a/src/imports/folderlistmodel/plugin.cpp
+++ b/src/imports/folderlistmodel/plugin.cpp
@@ -46,6 +46,7 @@
QT_BEGIN_NAMESPACE
+//![class decl]
class QmlFolderListModelPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
@@ -56,10 +57,13 @@ public:
qmlRegisterType<QDeclarativeFolderListModel>(uri,1,0,"FolderListModel");
}
};
+//![class decl]
QT_END_NAMESPACE
#include "plugin.moc"
+//![plugin export decl]
Q_EXPORT_PLUGIN2(qmlfolderlistmodelplugin, QT_PREPEND_NAMESPACE(QmlFolderListModelPlugin));
+//![plugin export decl]
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
index a16f0c6..6a7383a 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
@@ -39,11 +39,14 @@
**
****************************************************************************/
+//![code]
#include "qdeclarativefolderlistmodel.h"
#include <QDirModel>
#include <QDebug>
#include <qdeclarativecontext.h>
+QT_BEGIN_NAMESPACE
+
class QDeclarativeFolderListModelPrivate
{
public:
@@ -99,6 +102,12 @@ public:
separator, Qt will translate your paths to conform to the underlying
operating system.
+ This type is made available by importing the \c Qt.labs.folderlistmodel module.
+ \e {Elements in the Qt.labs module are not guaranteed to remain compatible
+ in future versions.}
+
+ \bold{import Qt.labs.folderlistmodel 1.0}
+
The roles available are:
\list
\o fileName
@@ -387,3 +396,6 @@ void QDeclarativeFolderListModel::setShowOnlyReadable(bool on)
else
d->model.setFilter(d->model.filter() & ~QDir::Readable);
}
+
+//![code]
+QT_END_NAMESPACE
diff --git a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
index e610a14..ea7d701 100644
--- a/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
@@ -47,15 +47,25 @@
#include <QUrl>
#include <QAbstractListModel>
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
class QDeclarativeContext;
class QModelIndex;
class QDeclarativeFolderListModelPrivate;
+
+//![class begin]
class QDeclarativeFolderListModel : public QAbstractListModel, public QDeclarativeParserStatus
{
Q_OBJECT
Q_INTERFACES(QDeclarativeParserStatus)
+//![class begin]
+//![class props]
Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged)
Q_PROPERTY(QUrl parentFolder READ parentFolder NOTIFY folderChanged)
Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters)
@@ -65,7 +75,9 @@ class QDeclarativeFolderListModel : public QAbstractListModel, public QDeclarati
Q_PROPERTY(bool showDotAndDotDot READ showDotAndDotDot WRITE setShowDotAndDotDot)
Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable)
Q_PROPERTY(int count READ count)
+//![class props]
+//![abslistmodel]
public:
QDeclarativeFolderListModel(QObject *parent = 0);
~QDeclarativeFolderListModel();
@@ -74,9 +86,13 @@ public:
int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
+//![abslistmodel]
+//![count]
int count() const { return rowCount(QModelIndex()); }
+//![count]
+//![prop funcs]
QUrl folder() const;
void setFolder(const QUrl &folder);
@@ -85,11 +101,6 @@ public:
QStringList nameFilters() const;
void setNameFilters(const QStringList &filters);
- virtual void classBegin();
- virtual void componentComplete();
-
- Q_INVOKABLE bool isFolder(int index) const;
-
enum SortField { Unsorted, Name, Time, Size, Type };
SortField sortField() const;
void setSortField(SortField field);
@@ -104,10 +115,23 @@ public:
void setShowDotAndDotDot(bool);
bool showOnlyReadable() const;
void setShowOnlyReadable(bool);
+//![prop funcs]
+
+//![isfolder]
+ Q_INVOKABLE bool isFolder(int index) const;
+//![isfolder]
+
+//![parserstatus]
+ virtual void classBegin();
+ virtual void componentComplete();
+//![parserstatus]
+//![notifier]
Q_SIGNALS:
void folderChanged();
+//![notifier]
+//![class end]
private Q_SLOTS:
void refresh();
void inserted(const QModelIndex &index, int start, int end);
@@ -118,7 +142,14 @@ private:
Q_DISABLE_COPY(QDeclarativeFolderListModel)
QDeclarativeFolderListModelPrivate *d;
};
+//![class end]
+QT_END_NAMESPACE
+
+//![qml decl]
QML_DECLARE_TYPE(QDeclarativeFolderListModel)
+//![qml decl]
+
+QT_END_HEADER
#endif // QDECLARATIVEFOLDERLISTMODEL_H