summaryrefslogtreecommitdiffstats
path: root/examples/wayland/custom-extension/compositor/qml/main.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/wayland/custom-extension/compositor/qml/main.qml')
-rw-r--r--examples/wayland/custom-extension/compositor/qml/main.qml37
1 files changed, 37 insertions, 0 deletions
diff --git a/examples/wayland/custom-extension/compositor/qml/main.qml b/examples/wayland/custom-extension/compositor/qml/main.qml
index 6739a5c9c..a7d762276 100644
--- a/examples/wayland/custom-extension/compositor/qml/main.qml
+++ b/examples/wayland/custom-extension/compositor/qml/main.qml
@@ -139,6 +139,40 @@ WaylandCompositor {
}
}
+
+ Component {
+ id: customObjectComponent
+ Rectangle {
+ id: customItem
+ property QtObject obj
+ property alias text: label.text
+
+ width: 100
+ height: 100
+ radius: width/2
+ x: Math.random() * (defaultOutput.surfaceArea.width - 100)
+ y: Math.random() * (defaultOutput.surfaceArea.height - 100)
+
+ Text {
+ id: label
+ anchors.centerIn: parent
+ text: "?"
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: obj.sendClicked()
+ }
+
+ Connections {
+ target: obj
+ onResourceDestroyed: {
+ customItem.destroy()
+ }
+ }
+ }
+ }
+
WlShell {
id: defaultShell
onWlShellSurfaceCreated: {
@@ -168,6 +202,9 @@ WaylandCompositor {
var item = itemForSurface(surface)
item.doSpin(ms)
}
+ onCustomObjectCreated: {
+ var item = customObjectComponent.createObject(defaultOutput.surfaceArea, { "color": obj.color, "text": obj.text, "obj": obj } );
+ }
}
function setDecorations(shown) {