summaryrefslogtreecommitdiffstats
path: root/examples/qmlListView/creator.h
diff options
context:
space:
mode:
authorMarius Bugge Monsen <mmonsen@trolltech.com>2009-07-30 13:52:25 +1000
committerMarius Bugge Monsen <mmonsen@trolltech.com>2009-07-30 13:52:25 +1000
commit38ff2e6f21b1196948eca97979f4a9840fe071f1 (patch)
tree9455166ee29a2359d84f7fcd6a23c6bb1e34e981 /examples/qmlListView/creator.h
parenta36573dbe4961a0289f7fc8ea27b2a5903429ffe (diff)
Separate the creator out into its own file.
Diffstat (limited to 'examples/qmlListView/creator.h')
-rw-r--r--examples/qmlListView/creator.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/qmlListView/creator.h b/examples/qmlListView/creator.h
new file mode 100644
index 0000000..6f081fb
--- /dev/null
+++ b/examples/qmlListView/creator.h
@@ -0,0 +1,33 @@
+#ifndef _CREATOR_H
+#define _CREATOR_H
+
+#include <qgraphicslistview.h>
+
+class QmlEngine;
+class QmlComponent;
+class QmlContext;
+class Context;
+
+class Creator : public QtGraphicsListViewItemCreatorBase
+{
+public:
+ Creator(QmlEngine *engine, QmlComponent *component);
+ ~Creator();
+
+ // creator api
+ QGraphicsObject *create(int index, QtGraphicsListView *view);
+ QGraphicsObject *reassign(int index, QGraphicsObject *item, QtGraphicsListView *view);
+ void recycle(QGraphicsObject *item, QtGraphicsListView *view);
+
+ // FIXME: make the creator a qobject and connect to itemsChanged
+ // the creator should keep a list of active objects so it can
+ // update the data in items that change in the model
+
+private:
+ void setContextProperties(int index, QmlContext *context, QtGraphicsListView *view) const;
+ QmlEngine *m_engine;
+ QmlComponent *m_component;
+ QHash<QGraphicsObject*, Context*> m_contexts;
+};
+
+#endif // _CREATOR_H