From fc8adfea9f5e09e5f47ac4e592e5d9db471caede Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 29 Nov 2013 13:21:38 +0100 Subject: Introduce helper for QML to allow creating QWidget hierarchies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 1259c5768e410361bcd8b5cf0c2057a2ebabda83 in qtdeclarative removed the ability to create QWidgets in QML by giving them the correct parent, which requires calling QWidget::setParent instead of QObject::setParent. This patch introduces a hook that will allow QtQml to give widgets a proper parent. Change-Id: I84c57ca5032582c43e405219343d55ac9cf2ffa0 Reviewed-by: Jørgen Lind --- src/corelib/kernel/qobject.cpp | 1 + src/corelib/kernel/qobject_p.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 223de0c8e0..2f9ef9ca4a 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -177,6 +177,7 @@ void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObj void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = 0; int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = 0; bool (*QAbstractDeclarativeData::isSignalConnected)(QAbstractDeclarativeData *, const QObject *, int) = 0; +void (*QAbstractDeclarativeData::setWidgetParent)(QObject *, QObject *) = 0; QObjectData::~QObjectData() {} diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index b663bc8d8c..dba5f0265f 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -87,6 +87,7 @@ public: static void (*signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **); static int (*receivers)(QAbstractDeclarativeData *, const QObject *, int); static bool (*isSignalConnected)(QAbstractDeclarativeData *, const QObject *, int); + static void (*setWidgetParent)(QObject *, QObject *); // Used by the QML engine to specify parents for widgets. Set by QtWidgets. }; // This is an implementation of QAbstractDeclarativeData that is identical with -- cgit v1.2.3