aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativepropertycache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qdeclarativepropertycache.cpp')
-rw-r--r--src/declarative/qml/qdeclarativepropertycache.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp
index bd3bc338ce..899bb1fce3 100644
--- a/src/declarative/qml/qdeclarativepropertycache.cpp
+++ b/src/declarative/qml/qdeclarativepropertycache.cpp
@@ -280,7 +280,7 @@ void QDeclarativePropertyCache::clear()
engine = 0;
}
-QDeclarativePropertyCache *QDeclarativePropertyCache::copy(int reserve)
+QDeclarativePropertyCache *QDeclarativePropertyCache::copy(int reserve)
{
QDeclarativePropertyCache *cache = new QDeclarativePropertyCache(engine);
cache->parent = this;
@@ -297,6 +297,41 @@ QDeclarativePropertyCache *QDeclarativePropertyCache::copy(int reserve)
return cache;
}
+QDeclarativePropertyCache *QDeclarativePropertyCache::copy()
+{
+ return copy(0);
+}
+
+QDeclarativePropertyCache *
+QDeclarativePropertyCache::copyAndAppend(QDeclarativeEngine *engine, const QMetaObject *metaObject,
+ QDeclarativePropertyData::Flag propertyFlags,
+ QDeclarativePropertyData::Flag methodFlags,
+ QDeclarativePropertyData::Flag signalFlags)
+{
+ return copyAndAppend(engine, metaObject, -1, propertyFlags, methodFlags, signalFlags);
+}
+
+QDeclarativePropertyCache *
+QDeclarativePropertyCache::copyAndAppend(QDeclarativeEngine *engine, const QMetaObject *metaObject,
+ int revision,
+ QDeclarativePropertyData::Flag propertyFlags,
+ QDeclarativePropertyData::Flag methodFlags,
+ QDeclarativePropertyData::Flag signalFlags)
+{
+ Q_ASSERT(QMetaObjectPrivate::get(metaObject)->revision >= 4);
+
+ // Reserve enough space in the name hash for all the methods (including signals), all the
+ // signal handlers and all the properties. This assumes no name clashes, but this is the
+ // common case.
+ QDeclarativePropertyCache *rv = copy(QMetaObjectPrivate::get(metaObject)->methodCount +
+ QMetaObjectPrivate::get(metaObject)->signalCount +
+ QMetaObjectPrivate::get(metaObject)->propertyCount);
+
+ rv->append(engine, metaObject, revision, propertyFlags, methodFlags, signalFlags);
+
+ return rv;
+}
+
void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaObject *metaObject,
QDeclarativePropertyData::Flag propertyFlags,
QDeclarativePropertyData::Flag methodFlags,