diff options
author | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-09-29 12:45:04 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-09-29 11:50:45 +0000 |
commit | 22916e25e91d901c98e45f993afc7e203686d248 (patch) | |
tree | d805a9d70029e0844d34f0db29132ca260e260da | |
parent | 8b2c8f22b0157311ff5a0e1df4b24fc568a15660 (diff) | |
download | qtwayland-22916e25e91d901c98e45f993afc7e203686d248.tar.gz |
Add raise() and lower() to QWaylandQuickItem
Change-Id: Idbd0ec7e8b77f6241aa6ac91639d76a0ffe2dae9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
-rw-r--r-- | examples/wayland/multi-output/qml/GridScreen.qml | 5 | ||||
-rw-r--r-- | examples/wayland/multi-output/qml/main.qml | 3 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem.cpp | 18 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem.h | 2 |
4 files changed, 27 insertions, 1 deletions
diff --git a/examples/wayland/multi-output/qml/GridScreen.qml b/examples/wayland/multi-output/qml/GridScreen.qml index 83f9c320..e7293731 100644 --- a/examples/wayland/multi-output/qml/GridScreen.qml +++ b/examples/wayland/multi-output/qml/GridScreen.qml @@ -66,12 +66,17 @@ WaylandOutput { cellWidth: 200 cellHeight: 200 delegate: WaylandQuickItem { + id: item surface: gridSurface width: gridView.cellWidth height: gridView.cellHeight sizeFollowsSurface: false inputEventsEnabled: false view.discardFrontBuffers: true + MouseArea { + anchors.fill: parent + onClicked: item.surface.activated() + } } } } diff --git a/examples/wayland/multi-output/qml/main.qml b/examples/wayland/multi-output/qml/main.qml index 0a479157..e04f3cac 100644 --- a/examples/wayland/multi-output/qml/main.qml +++ b/examples/wayland/multi-output/qml/main.qml @@ -65,6 +65,7 @@ WaylandCompositor { id: surfaceComponent WaylandSurface { id: surface + signal activated() onMappedChanged: { if (isMapped && !cursorSurface) { gridScreen.gridSurfaces.append( { "gridSurface" : surface } ); @@ -87,7 +88,7 @@ WaylandCompositor { onCreateShellSurface: { var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "surface": surface } ); item.shellSurface.initialize(defaultShell, surface, client, id); - item.surface + surface.activated.connect(item.raise); } Component.onCompleted: { diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 4928389f..eea2814b 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -588,4 +588,22 @@ void QWaylandQuickItem::setInputEventsEnabled(bool enabled) } } +void QWaylandQuickItem::lower() +{ + QQuickItem *parent = parentItem(); + Q_ASSERT(parent); + QQuickItem *bottom = parent->childItems().first(); + if (this != bottom) + stackBefore(bottom); +} + +void QWaylandQuickItem::raise() +{ + QQuickItem *parent = parentItem(); + Q_ASSERT(parent); + QQuickItem *top = parent->childItems().last(); + if (this != top) + stackAfter(top); +} + QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h index 81322451..7737fe30 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.h +++ b/src/compositor/compositor_api/qwaylandquickitem.h @@ -118,6 +118,8 @@ protected: public Q_SLOTS: virtual void takeFocus(QWaylandInputDevice *device = 0); void setPaintEnabled(bool paintEnabled); + void raise(); + void lower(); private Q_SLOTS: void surfaceMappedChanged(); |