summaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-08-21 16:31:38 +0200
committerJohan Helsing <johan.helsing@qt.io>2018-08-29 06:36:17 +0000
commitec01fddd6b14fa26d9ae9e9f693c6fd419f5ba2c (patch)
treea0c8a3a76f61df7e24c29cdc6e7686eaa884f553 /src/imports
parent9875a14daaec12ca65d3cb4a2aaf2c4582e6191d (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/imports')
-rw-r--r--src/imports/compositor/qwaylandquickcompositorplugin.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
index f4e727893..1c576b6a1 100644
--- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp
+++ b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
@@ -74,21 +74,12 @@
QT_BEGIN_NAMESPACE
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS(QWaylandQuickCompositor)
-Q_COMPOSITOR_DECLARE_QUICK_PARENT_CLASS(QWaylandQuickOutput)
-Q_COMPOSITOR_DECLARE_QUICK_PARENT_CLASS(QWaylandQuickSurface)
-Q_COMPOSITOR_DECLARE_QUICK_PARENT_CLASS(QWaylandKeymap)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandQtWindowManager)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandIviApplication)
-Q_COMPOSITOR_DECLARE_QUICK_PARENT_CLASS(QWaylandIviSurface)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandWlShell)
-Q_COMPOSITOR_DECLARE_QUICK_PARENT_CLASS(QWaylandWlShellSurface)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShellV5)
-Q_COMPOSITOR_DECLARE_QUICK_PARENT_CLASS(QWaylandXdgSurfaceV5)
-Q_COMPOSITOR_DECLARE_QUICK_PARENT_CLASS(QWaylandXdgPopupV5)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShellV6)
-Q_COMPOSITOR_DECLARE_QUICK_PARENT_CLASS(QWaylandXdgSurfaceV6)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgShell)
-Q_COMPOSITOR_DECLARE_QUICK_PARENT_CLASS(QWaylandXdgSurface)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandXdgDecorationManagerV1)
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(QWaylandTextInputManager)
@@ -141,9 +132,9 @@ public:
qmlRegisterType<QWaylandQuickItem>(uri, 1, 0, "WaylandQuickItem");
qmlRegisterType<QWaylandQuickHardwareLayer>(uri, 1, 2, "WaylandHardwareLayer");
qmlRegisterType<QWaylandMouseTracker>(uri, 1, 0, "WaylandMouseTracker");
- qmlRegisterType<QWaylandQuickOutputQuickParent>(uri, 1, 0, "WaylandOutput");
- qmlRegisterType<QWaylandQuickSurfaceQuickParent>(uri, 1, 0, "WaylandSurface");
- qmlRegisterType<QWaylandKeymapQuickParent>(uri, 1, 0, "WaylandKeymap");
+ qmlRegisterType<QWaylandQuickOutput>(uri, 1, 0, "WaylandOutput");
+ qmlRegisterType<QWaylandQuickSurface>(uri, 1, 0, "WaylandSurface");
+ qmlRegisterType<QWaylandKeymap>(uri, 1, 0, "WaylandKeymap");
qmlRegisterUncreatableType<QWaylandCompositorExtension>(uri, 1, 0, "WaylandExtension", QObject::tr("Cannot create instance of WaylandExtension"));
qmlRegisterUncreatableType<QWaylandClient>(uri, 1, 0, "WaylandClient", QObject::tr("Cannot create instance of WaylandClient"));
@@ -161,23 +152,23 @@ public:
//This should probably be somewhere else
qmlRegisterType<QWaylandQtWindowManagerQuickExtension>(uri, 1, 0, "QtWindowManager");
qmlRegisterType<QWaylandIviApplicationQuickExtension>(uri, 1, 0, "IviApplication");
- qmlRegisterType<QWaylandIviSurfaceQuickParent>(uri, 1, 0, "IviSurface");
+ qmlRegisterType<QWaylandIviSurface>(uri, 1, 0, "IviSurface");
qmlRegisterType<QWaylandWlShellQuickExtension>(uri, 1, 0, "WlShell");
- qmlRegisterType<QWaylandWlShellSurfaceQuickParent>(uri, 1, 0, "WlShellSurface");
+ qmlRegisterType<QWaylandWlShellSurface>(uri, 1, 0, "WlShellSurface");
qmlRegisterType<QWaylandQuickShellSurfaceItem>(uri, 1, 0, "ShellSurfaceItem");
qmlRegisterUncreatableType<QWaylandXdgShellV5>(uri, 1, 0, "XdgShellV5Base", QObject::tr("Cannot create instance of XdgShellV5Base"));
qmlRegisterType<QWaylandXdgShellV5QuickExtension>(uri, 1, 0, "XdgShellV5");
- qmlRegisterType<QWaylandXdgSurfaceV5QuickParent>(uri, 1, 0, "XdgSurfaceV5");
- qmlRegisterType<QWaylandXdgPopupV5QuickParent>(uri, 1, 0, "XdgPopupV5");
+ qmlRegisterType<QWaylandXdgSurfaceV5>(uri, 1, 0, "XdgSurfaceV5");
+ qmlRegisterType<QWaylandXdgPopupV5>(uri, 1, 0, "XdgPopupV5");
qmlRegisterType<QWaylandTextInputManagerQuickExtension>(uri, 1, 0, "TextInputManager");
qmlRegisterType<QWaylandXdgShellV6QuickExtension>(uri, 1, 1, "XdgShellV6");
- qmlRegisterType<QWaylandXdgSurfaceV6QuickParent>(uri, 1, 1, "XdgSurfaceV6");
+ qmlRegisterType<QWaylandXdgSurfaceV6>(uri, 1, 1, "XdgSurfaceV6");
qmlRegisterUncreatableType<QWaylandXdgToplevelV6>(uri, 1, 1, "XdgToplevelV6", QObject::tr("Cannot create instance of XdgShellToplevelV6"));
qmlRegisterUncreatableType<QWaylandXdgPopupV6>(uri, 1, 1, "XdgPopupV6", QObject::tr("Cannot create instance of XdgShellPopupV6"));
qmlRegisterType<QWaylandXdgShellQuickExtension>(uri, 1, 3, "XdgShell");
- qmlRegisterType<QWaylandXdgSurfaceQuickParent>(uri, 1, 3, "XdgSurface");
+ qmlRegisterType<QWaylandXdgSurface>(uri, 1, 3, "XdgSurface");
qmlRegisterUncreatableType<QWaylandXdgToplevel>(uri, 1, 3, "XdgToplevel", QObject::tr("Cannot create instance of XdgShellToplevel"));
qmlRegisterUncreatableType<QWaylandXdgPopup>(uri, 1, 3, "XdgPopup", QObject::tr("Cannot create instance of XdgShellPopup"));