From 51768025a100232743290fa07fc5c46821c16556 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 17 Aug 2018 17:59:42 +0200 Subject: server-side-decoration example: Implement window move Change-Id: I5e876338a37dc3126ce8b7950d2eef58ec09c07d Reviewed-by: Johan Helsing --- examples/wayland/server-side-decoration/main.qml | 35 ++++++++++++++++-------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/examples/wayland/server-side-decoration/main.qml b/examples/wayland/server-side-decoration/main.qml index 8ec50dd57..5847ce411 100644 --- a/examples/wayland/server-side-decoration/main.qml +++ b/examples/wayland/server-side-decoration/main.qml @@ -48,7 +48,7 @@ ** ****************************************************************************/ -import QtQuick 2.6 +import QtQuick 2.12 import QtQuick.Window 2.2 import QtQuick.Layouts 1.3 import QtWayland.Compositor 1.3 @@ -61,29 +61,40 @@ WaylandCompositor { width: 1024 height: 768 visible: true + Rectangle { + anchors.fill: parent + gradient: "MorpheusDen" + } + Repeater { model: shellSurfaces Column { + id: chrome + width: shellSurfaceItem.implicitWidth Rectangle { visible: modelData.toplevel.decorationMode === XdgToplevel.ServerSideDecoration width: parent.width height: 30 gradient: "HeavyRain"; - RowLayout { - anchors.fill: parent - Text { - text: modelData.toplevel.title - Layout.fillWidth: true - } - MouseArea { - width: 30 - height: 30 - Text { text: "X"; anchors.centerIn: parent } - onClicked: modelData.toplevel.sendClose() + Text { + text: modelData.toplevel.title + anchors.centerIn: parent + } + Item { + anchors.right: parent.right + width: 30 + height: 30 + Text { text: "X"; anchors.centerIn: parent } + TapHandler { + onTapped: modelData.toplevel.sendClose() } } + DragHandler { + target: chrome + } } ShellSurfaceItem { + id: shellSurfaceItem moveItem: parent autoCreatePopupItems: true shellSurface: modelData -- cgit v1.2.3