From ec01fddd6b14fa26d9ae9e9f693c6fd419f5ba2c Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 21 Aug 2018 16:31:38 +0200 Subject: Fix incompatibility between QML and C++ instantiated objects This fixes a source incompatibility introduced in 9ebba7c3a. In Qt 5.11 it was possible to have the following code: XdgShellV6 { property XdgToplevelV6 top onToplevelCreated: top = toplevel } After, 9ebba7c3a, however, this would fail because XdgToplevel refers to QWaylandXdgToplevelV6ParentClass, while QWaylandXdgShellV6::toplevelCreated emits a QWaylandXdgToplevelV6. It would also break instanceof, i.e.: onToplevelCreated: console.log(toplevel instanceof XdgToplevelV6) This patch reverts to C++ and QML using the same type (no subclassing for QML types), but still lets the items have children in QML by putting the macro inside each class instead. Task-number: QTBUG-70090 Change-Id: I8efa8f68ebc4dc2289b4a9b96402b0c00d45547d Reviewed-by: Paul Olav Tvete --- src/compositor/global/qwaylandquickextension.h | 36 -------------------------- 1 file changed, 36 deletions(-) (limited to 'src/compositor/global') diff --git a/src/compositor/global/qwaylandquickextension.h b/src/compositor/global/qwaylandquickextension.h index a0e07dad3..c721bcb97 100644 --- a/src/compositor/global/qwaylandquickextension.h +++ b/src/compositor/global/qwaylandquickextension.h @@ -107,42 +107,6 @@ QT_BEGIN_NAMESPACE QList m_objects; \ }; -#define Q_COMPOSITOR_DECLARE_QUICK_PARENT_CLASS(className) \ - class Q_WAYLAND_COMPOSITOR_EXPORT className##QuickParent : public className \ - { \ -/* qmake ignore Q_OBJECT */ \ - Q_OBJECT \ - Q_PROPERTY(QQmlListProperty data READ data DESIGNABLE false) \ - Q_CLASSINFO("DefaultProperty", "data") \ - public: \ - QQmlListProperty data() \ - { \ - return QQmlListProperty(this, this, \ - &className##QuickParent::appendFunction, \ - &className##QuickParent::countFunction, \ - &className##QuickParent::atFunction, \ - &className##QuickParent::clearFunction); \ - } \ - static void appendFunction(QQmlListProperty *list, QObject *object) \ - { \ - static_cast(list->data)->m_children.append(object); \ - } \ - static int countFunction(QQmlListProperty *list) \ - { \ - return static_cast(list->data)->m_children.size(); \ - } \ - static QObject *atFunction(QQmlListProperty *list, int index) \ - { \ - return static_cast(list->data)->m_children.at(index); \ - } \ - static void clearFunction(QQmlListProperty *list) \ - { \ - static_cast(list->data)->m_children.clear(); \ - } \ - private: \ - QVector m_children; \ - }; - QT_END_NAMESPACE #endif /*QWAYLANDQUICKEXTENSION_H*/ -- cgit v1.2.3