aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlengine.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-11-25 10:11:10 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-25 12:38:40 +0100
commit26350b5ceafa0ade1328037f6234a7d288eb8f48 (patch)
tree5af090a3c9ca22a9f264139a4f0af5e2d58c62a5 /src/qml/qml/qqmlengine.cpp
parentc962cc45711e09dddc5690d581bee29bf52f8cf9 (diff)
Allow for QtQml and QtDeclarative to co-exist at run-time
This patch changes QQmlData to share the very first bit with QDeclarativeData, to indicate if the QObject in question is exposed in the QML1 or QML2 run-time. Task-number: QTBUG-35006 Change-Id: I3aa1d7c99038792011afd9f481ad30d9b981721f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r--src/qml/qml/qqmlengine.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 81ccec3571..d082b9a8fd 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -615,12 +615,18 @@ void QQmlPrivate::qdeclarativeelement_destructor(QObject *o)
void QQmlData::destroyed(QAbstractDeclarativeData *d, QObject *o)
{
- static_cast<QQmlData *>(d)->destroyed(o);
+ QQmlData *ddata = static_cast<QQmlData *>(d);
+ if (ddata->ownedByQml1)
+ return;
+ ddata->destroyed(o);
}
void QQmlData::parentChanged(QAbstractDeclarativeData *d, QObject *o, QObject *p)
{
- static_cast<QQmlData *>(d)->parentChanged(o, p);
+ QQmlData *ddata = static_cast<QQmlData *>(d);
+ if (ddata->ownedByQml1)
+ return;
+ ddata->parentChanged(o, p);
}
class QQmlThreadNotifierProxyObject : public QObject
@@ -649,6 +655,7 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in
{
QQmlData *ddata = QQmlData::get(object, false);
if (!ddata) return; // Probably being deleted
+ if (ddata->ownedByQml1) return;
// In general, QML only supports QObject's that live on the same thread as the QQmlEngine
// that they're exposed to. However, to make writing "worker objects" that calculate data
@@ -706,12 +713,18 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in
int QQmlData::receivers(QAbstractDeclarativeData *d, const QObject *, int index)
{
- return static_cast<QQmlData *>(d)->endpointCount(index);
+ QQmlData *ddata = static_cast<QQmlData *>(d);
+ if (ddata->ownedByQml1)
+ return 0;
+ return ddata->endpointCount(index);
}
bool QQmlData::isSignalConnected(QAbstractDeclarativeData *d, const QObject *, int index)
{
- return static_cast<QQmlData *>(d)->signalHasEndpoint(index);
+ QQmlData *ddata = static_cast<QQmlData *>(d);
+ if (ddata->ownedByQml1)
+ return false;
+ return ddata->signalHasEndpoint(index);
}
int QQmlData::endpointCount(int index)