diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-08-21 16:31:38 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-08-29 06:36:17 +0000 |
commit | ec01fddd6b14fa26d9ae9e9f693c6fd419f5ba2c (patch) | |
tree | a0c8a3a76f61df7e24c29cdc6e7686eaa884f553 /src/compositor/global | |
parent | 9875a14daaec12ca65d3cb4a2aaf2c4582e6191d (diff) |
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 <paul.tvete@qt.io>
Diffstat (limited to 'src/compositor/global')
-rw-r--r-- | src/compositor/global/qwaylandquickextension.h | 36 |
1 files changed, 0 insertions, 36 deletions
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<QObject *> 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<QObject> data READ data DESIGNABLE false) \ - Q_CLASSINFO("DefaultProperty", "data") \ - public: \ - QQmlListProperty<QObject> data() \ - { \ - return QQmlListProperty<QObject>(this, this, \ - &className##QuickParent::appendFunction, \ - &className##QuickParent::countFunction, \ - &className##QuickParent::atFunction, \ - &className##QuickParent::clearFunction); \ - } \ - static void appendFunction(QQmlListProperty<QObject> *list, QObject *object) \ - { \ - static_cast<className##QuickParent *>(list->data)->m_children.append(object); \ - } \ - static int countFunction(QQmlListProperty<QObject> *list) \ - { \ - return static_cast<className##QuickParent *>(list->data)->m_children.size(); \ - } \ - static QObject *atFunction(QQmlListProperty<QObject> *list, int index) \ - { \ - return static_cast<className##QuickParent *>(list->data)->m_children.at(index); \ - } \ - static void clearFunction(QQmlListProperty<QObject> *list) \ - { \ - static_cast<className##QuickParent *>(list->data)->m_children.clear(); \ - } \ - private: \ - QVector<QObject *> m_children; \ - }; - QT_END_NAMESPACE #endif /*QWAYLANDQUICKEXTENSION_H*/ |