diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2018-08-17 17:59:42 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2018-08-21 09:35:45 +0000 |
commit | 51768025a100232743290fa07fc5c46821c16556 (patch) | |
tree | 292518c4aadc9d22cb3dc962b77c517febe305f5 | |
parent | c7e775aef78b655666916bba15196c89dbf0b43d (diff) | |
download | qtwayland-51768025a100232743290fa07fc5c46821c16556.tar.gz |
server-side-decoration example: Implement window move
Change-Id: I5e876338a37dc3126ce8b7950d2eef58ec09c07d
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
-rw-r--r-- | examples/wayland/server-side-decoration/main.qml | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/examples/wayland/server-side-decoration/main.qml b/examples/wayland/server-side-decoration/main.qml index 8ec50dd5..5847ce41 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 |