summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/qmlmetatype.cpp5
-rw-r--r--src/declarative/qml/qmlproxymetaobject.cpp28
-rw-r--r--src/declarative/qml/qmlproxymetaobject_p.h1
3 files changed, 31 insertions, 3 deletions
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index 3e25ae0..8ce8571 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -214,9 +214,12 @@ void QmlTypePrivate::init() const
mo = mo->d.superdata;
}
- for (int ii = 0; ii < m_metaObjects.count(); ++ii)
+ for (int ii = 0; ii < m_metaObjects.count(); ++ii) {
m_metaObjects[ii].propertyOffset =
m_metaObjects.at(ii).metaObject->propertyOffset();
+ m_metaObjects[ii].methodOffset =
+ m_metaObjects.at(ii).metaObject->methodOffset();
+ }
// Calculate hash
QByteArray hashData;
diff --git a/src/declarative/qml/qmlproxymetaobject.cpp b/src/declarative/qml/qmlproxymetaobject.cpp
index 686c6d7..06d8a50 100644
--- a/src/declarative/qml/qmlproxymetaobject.cpp
+++ b/src/declarative/qml/qmlproxymetaobject.cpp
@@ -78,6 +78,7 @@ QmlProxyMetaObject::~QmlProxyMetaObject()
proxies = 0;
}
+#include <QDebug>
int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
{
if ((c == QMetaObject::ReadProperty ||
@@ -93,8 +94,24 @@ int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
sizeof(QObject *) * metaObjects->count());
}
- if (!proxies[ii])
- proxies[ii] = data.createFunc(object);
+ if (!proxies[ii]) {
+ QObject *proxy = data.createFunc(object);
+ const QMetaObject *metaObject = proxy->metaObject();
+ proxies[ii] = proxy;
+
+ int localOffset = data.metaObject->methodOffset();
+ int methodOffset = metaObject->methodOffset();
+ int methods = metaObject->methodCount() - methodOffset;
+
+ // ### - Can this be done more optimally?
+ for (int jj = 0; jj < methods; ++jj) {
+ QMetaMethod method =
+ metaObject->method(jj + methodOffset);
+ if (method.methodType() == QMetaMethod::Signal)
+ QMetaObject::connect(proxy, methodOffset + jj,
+ object, localOffset + jj);
+ }
+ }
int proxyOffset = proxies[ii]->metaObject()->propertyOffset();
int proxyId = id - data.propertyOffset + proxyOffset;
@@ -102,6 +119,13 @@ int QmlProxyMetaObject::metaCall(QMetaObject::Call c, int id, void **a)
return proxies[ii]->qt_metacall(c, proxyId, a);
}
}
+ } else if (c == QMetaObject::InvokeMetaMethod &&
+ id >= metaObjects->last().methodOffset) {
+ QMetaMethod m = object->metaObject()->method(id);
+ if (m.methodType() == QMetaMethod::Signal) {
+ QMetaObject::activate(object, id, a);
+ return -1;
+ }
}
if (parent)
diff --git a/src/declarative/qml/qmlproxymetaobject_p.h b/src/declarative/qml/qmlproxymetaobject_p.h
index 0ffa365..c0ce36e 100644
--- a/src/declarative/qml/qmlproxymetaobject_p.h
+++ b/src/declarative/qml/qmlproxymetaobject_p.h
@@ -61,6 +61,7 @@ public:
QMetaObject *metaObject;
CreateFunc createFunc;
int propertyOffset;
+ int methodOffset;
};
QmlProxyMetaObject(QObject *, QList<ProxyData> *);