summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlworkerscript_p.h
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-01-19 04:54:24 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-01-19 04:54:24 (GMT)
commitcdf57ac7a20fb29c1835ccff1dd668aeeba8d71f (patch)
tree39630f292912184712dda2fa5882a6a590a0f0b8 /src/declarative/qml/qmlworkerscript_p.h
parent64016d66789950c041bbcc7469aa08653f7fd424 (diff)
downloadQt-cdf57ac7a20fb29c1835ccff1dd668aeeba8d71f.zip
Qt-cdf57ac7a20fb29c1835ccff1dd668aeeba8d71f.tar.gz
Qt-cdf57ac7a20fb29c1835ccff1dd668aeeba8d71f.tar.bz2
Basic WorkerListModel implementation
Diffstat (limited to 'src/declarative/qml/qmlworkerscript_p.h')
-rw-r--r--src/declarative/qml/qmlworkerscript_p.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlworkerscript_p.h b/src/declarative/qml/qmlworkerscript_p.h
index 1ec7af3..fdc726e 100644
--- a/src/declarative/qml/qmlworkerscript_p.h
+++ b/src/declarative/qml/qmlworkerscript_p.h
@@ -55,11 +55,14 @@
#include "qml.h"
#include "qmlparserstatus.h"
+#include <private/qlistmodelinterface_p.h>
#include <QtCore/qthread.h>
#include <QtScript/qscriptvalue.h>
#include <QtCore/qurl.h>
+QT_BEGIN_NAMESPACE
+
class QmlWorkerScript;
class QmlWorkerScriptEnginePrivate;
class QmlWorkerScriptEngine : public QThread
@@ -110,6 +113,44 @@ private:
int m_scriptId;
QUrl m_source;
};
+
+class QmlWorkerListModelAgent;
+class QmlWorkerListModel : public QListModelInterface
+{
+ Q_OBJECT
+
+public:
+ QmlWorkerListModel(QObject * = 0);
+ virtual ~QmlWorkerListModel();
+
+ Q_INVOKABLE void clear();
+ Q_INVOKABLE void remove(int index);
+ Q_INVOKABLE void append(const QScriptValue &);
+ Q_INVOKABLE void insert(int index, const QScriptValue&);
+ Q_INVOKABLE QScriptValue get(int index) const;
+ Q_INVOKABLE void set(int index, const QScriptValue &);
+
+ QmlWorkerListModelAgent *agent();
+
+ virtual QList<int> roles() const;
+ virtual QString toString(int role) const;
+ virtual int count() const;
+ virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const;
+ virtual QVariant data(int index, int role) const;
+
+private:
+ friend class QmlWorkerListModelAgent;
+
+ QHash<int, QString> m_roles;
+ QHash<QString, int> m_strings;
+ QList<QHash<int, QVariant> > m_values;
+
+ QmlWorkerListModelAgent *m_agent;
+};
+
+QT_END_NAMESPACE
+
QML_DECLARE_TYPE(QmlWorkerScript);
+QML_DECLARE_TYPE(QmlWorkerListModel);
#endif // QMLWORKERSCRIPT_P_H