aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmldelegatemodel_p_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/types/qqmldelegatemodel_p_p.h')
-rw-r--r--src/qml/types/qqmldelegatemodel_p_p.h53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h
index 68242f433d..4e1adf175a 100644
--- a/src/qml/types/qqmldelegatemodel_p_p.h
+++ b/src/qml/types/qqmldelegatemodel_p_p.h
@@ -75,40 +75,27 @@ public:
~QQmlDelegateModelItemMetaType();
void initializeMetaObject();
- void initializeConstructor();
+ void initializePrototype();
int parseGroups(const QStringList &groupNames) const;
- int parseGroups(const v8::Local<v8::Value> &groupNames) const;
-
- static void release_index(v8::Persistent<v8::Value> object, void *parameter);
- static void release_model(v8::Persistent<v8::Value> object, void *parameter);
-
- static v8::Handle<v8::Value> get_model(v8::Local<v8::String>, const v8::AccessorInfo &info);
- static v8::Handle<v8::Value> get_groups(v8::Local<v8::String>, const v8::AccessorInfo &info);
- static void set_groups(
- v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info);
- static v8::Handle<v8::Value> get_member(v8::Local<v8::String>, const v8::AccessorInfo &info);
- static void set_member(
- v8::Local<v8::String>, v8::Local<v8::Value> value, const v8::AccessorInfo &info);
- static v8::Handle<v8::Value> get_index(v8::Local<v8::String>, const v8::AccessorInfo &info);
+ int parseGroups(const QV4::Value &groupNames) const;
QQmlGuard<QQmlDelegateModel> model;
const int groupCount;
QV8Engine * const v8Engine;
QQmlDelegateModelAttachedMetaObject *metaObject;
const QStringList groupNames;
- v8::Persistent<v8::ObjectTemplate> constructor;
+ QV4::PersistentValue modelItemProto;
};
class QQmlAdaptorModel;
class QQDMIncubationTask;
-class QQmlDelegateModelItem : public QObject, public QV8ObjectResource
+class QQmlDelegateModelItem : public QObject
{
Q_OBJECT
Q_PROPERTY(int index READ modelIndex NOTIFY modelIndexChanged)
Q_PROPERTY(QObject *model READ modelObject CONSTANT)
- V8_RESOURCE_TYPE(VisualDataItemType)
public:
QQmlDelegateModelItem(QQmlDelegateModelItemMetaType *metaType, int modelIndex);
~QQmlDelegateModelItem();
@@ -141,11 +128,19 @@ public:
int modelIndex() const { return index; }
void setModelIndex(int idx) { index = idx; emit modelIndexChanged(); }
- virtual v8::Handle<v8::Value> get() { return engine->newQObject(this); }
+ virtual QV4::Value get() { return QV4::QObjectWrapper::wrap(v4, this); }
virtual void setValue(const QString &role, const QVariant &value) { Q_UNUSED(role); Q_UNUSED(value); }
virtual bool resolveIndex(const QQmlAdaptorModel &, int) { return false; }
+ static QV4::Value get_model(QV4::SimpleCallContext *ctx);
+ static QV4::Value get_groups(QV4::SimpleCallContext *ctx);
+ static QV4::Value set_groups(QV4::SimpleCallContext *ctx);
+ static QV4::Value get_member(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &);
+ static QV4::Value set_member(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &arg);
+ static QV4::Value get_index(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &arg);
+
+ QV4::ExecutionEngine *v4;
QQmlDelegateModelItemMetaType * const metaType;
QQmlContextData *contextData;
QObject *object;
@@ -164,6 +159,21 @@ protected:
void objectDestroyed(QObject *);
};
+struct QQmlDelegateModelItemObject : QV4::Object
+{
+ Q_MANAGED;
+ QQmlDelegateModelItemObject(QV4::ExecutionEngine *engine, QQmlDelegateModelItem *item)
+ : Object(engine)
+ , item(item)
+ { vtbl = &static_vtbl; }
+ ~QQmlDelegateModelItemObject();
+
+ static void destroy(Managed *that);
+
+ QQmlDelegateModelItem *item;
+};
+
+
class QQmlDelegateModelPrivate;
class QQDMIncubationTask : public QQmlIncubator
@@ -216,9 +226,9 @@ public:
void initPackage(int index, QQuickPackage *package);
void destroyingPackage(QQuickPackage *package);
- bool parseIndex(const v8::Local<v8::Value> &value, int *index, Compositor::Group *group) const;
+ bool parseIndex(const QV4::Value &value, int *index, Compositor::Group *group) const;
bool parseGroupArgs(
- QQmlV8Function *args, Compositor::Group *group, int *index, int *count, int *groups) const;
+ QQmlV4Function *args, Compositor::Group *group, int *index, int *count, int *groups) const;
Compositor::Group group;
QQmlGuard<QQmlDelegateModel> model;
@@ -276,11 +286,10 @@ public:
void itemsMoved(
const QVector<Compositor::Remove> &removes, const QVector<Compositor::Insert> &inserts);
void itemsChanged(const QVector<Compositor::Change> &changes);
- template <typename T> static v8::Local<v8::Array> buildChangeList(const QVector<T> &changes);
void emitChanges();
void emitModelUpdated(const QQmlChangeSet &changeSet, bool reset);
- bool insert(Compositor::insert_iterator &before, const v8::Local<v8::Object> &object, int groups);
+ bool insert(Compositor::insert_iterator &before, const QV4::Value &object, int groups);
static void group_append(QQmlListProperty<QQmlDelegateModelGroup> *property, QQmlDelegateModelGroup *group);
static int group_count(QQmlListProperty<QQmlDelegateModelGroup> *property);