summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-09-29 12:45:04 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-09-29 11:50:45 +0000
commit22916e25e91d901c98e45f993afc7e203686d248 (patch)
treed805a9d70029e0844d34f0db29132ca260e260da
parent8b2c8f22b0157311ff5a0e1df4b24fc568a15660 (diff)
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.qml5
-rw-r--r--examples/wayland/multi-output/qml/main.qml3
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp18
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.h2
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 83f9c3206..e72937316 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 0a4791572..e04f3cac8 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 4928389f1..eea2814b1 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 813224514..7737fe30f 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();