summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/wayland/ivi-compositor/main.qml2
-rw-r--r--examples/wayland/minimal-qml/main.qml2
-rw-r--r--src/compositor/compositor_api/qwaylandquickoutput.cpp16
-rw-r--r--src/compositor/compositor_api/qwaylandquickoutput.h5
4 files changed, 20 insertions, 5 deletions
diff --git a/examples/wayland/ivi-compositor/main.qml b/examples/wayland/ivi-compositor/main.qml
index 6535296b6..1f2420bf9 100644
--- a/examples/wayland/ivi-compositor/main.qml
+++ b/examples/wayland/ivi-compositor/main.qml
@@ -43,9 +43,7 @@ import QtWayland.Compositor 1.0
import QtQuick.Window 2.2
WaylandCompositor {
- id: wlcompositor
WaylandOutput {
- compositor: wlcompositor
sizeFollowsWindow: true
window: Window {
width: 1024
diff --git a/examples/wayland/minimal-qml/main.qml b/examples/wayland/minimal-qml/main.qml
index d44d0c6a1..732e2ccad 100644
--- a/examples/wayland/minimal-qml/main.qml
+++ b/examples/wayland/minimal-qml/main.qml
@@ -43,10 +43,8 @@ import QtQuick.Window 2.2
import QtWayland.Compositor 1.0
WaylandCompositor {
- id: wlcompositor
// The output defines the screen.
WaylandOutput {
- compositor: wlcompositor
sizeFollowsWindow: true
window: Window {
width: 1024
diff --git a/src/compositor/compositor_api/qwaylandquickoutput.cpp b/src/compositor/compositor_api/qwaylandquickoutput.cpp
index 0e25362fc..af21bd0cc 100644
--- a/src/compositor/compositor_api/qwaylandquickoutput.cpp
+++ b/src/compositor/compositor_api/qwaylandquickoutput.cpp
@@ -72,6 +72,22 @@ void QWaylandQuickOutput::initialize()
this, &QWaylandQuickOutput::doFrameCallbacks);
}
+void QWaylandQuickOutput::classBegin()
+{
+}
+
+void QWaylandQuickOutput::componentComplete()
+{
+ if (!compositor()) {
+ for (QObject *p = parent(); p != nullptr; p = p->parent()) {
+ if (auto c = qobject_cast<QWaylandCompositor *>(p)) {
+ setCompositor(c);
+ break;
+ }
+ }
+ }
+}
+
void QWaylandQuickOutput::update()
{
if (!m_updateScheduled) {
diff --git a/src/compositor/compositor_api/qwaylandquickoutput.h b/src/compositor/compositor_api/qwaylandquickoutput.h
index 2cef03282..37a47b844 100644
--- a/src/compositor/compositor_api/qwaylandquickoutput.h
+++ b/src/compositor/compositor_api/qwaylandquickoutput.h
@@ -46,8 +46,9 @@ QT_BEGIN_NAMESPACE
class QWaylandQuickCompositor;
class QQuickWindow;
-class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickOutput : public QWaylandOutput
+class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickOutput : public QWaylandOutput, public QQmlParserStatus
{
+ Q_INTERFACES(QQmlParserStatus)
Q_OBJECT
Q_PROPERTY(bool automaticFrameCallback READ automaticFrameCallback WRITE setAutomaticFrameCallback NOTIFY automaticFrameCallbackChanged)
public:
@@ -69,6 +70,8 @@ Q_SIGNALS:
protected:
void initialize() Q_DECL_OVERRIDE;
+ void classBegin() override;
+ void componentComplete() override;
private:
void doFrameCallbacks();