From ea929b6fa5a90602e6f1fb597e3edfed9e6de3a7 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 11 May 2021 12:44:34 +0200 Subject: doc: Expand documentation of Pure QML example Add details about what customizations are specific to this example. Task-number: QTBUG-91674 Change-Id: Icf2dd4fb2bcbd230bbadbb01e5a57f481ad178eb Reviewed-by: Paul Olav Tvete Reviewed-by: Eskil Abrahamsen Blomfeldt --- examples/wayland/pure-qml/qml/Chrome.qml | 28 ++++++++++++---------- examples/wayland/pure-qml/qml/CompositorScreen.qml | 6 +++++ examples/wayland/pure-qml/qml/Keyboard.qml | 2 ++ examples/wayland/pure-qml/qml/main.qml | 4 ++++ 4 files changed, 28 insertions(+), 12 deletions(-) (limited to 'examples/wayland/pure-qml/qml') diff --git a/examples/wayland/pure-qml/qml/Chrome.qml b/examples/wayland/pure-qml/qml/Chrome.qml index d9ff038c0..201fa5241 100644 --- a/examples/wayland/pure-qml/qml/Chrome.qml +++ b/examples/wayland/pure-qml/qml/Chrome.qml @@ -58,11 +58,25 @@ ShellSurfaceItem { signal destroyAnimationFinished + // ![destruction] onSurfaceDestroyed: { bufferLocked = true; destroyAnimation.start(); } + SequentialAnimation { + id: destroyAnimation + + ParallelAnimation { + NumberAnimation { target: scaleTransform; property: "yScale"; to: 2/height; duration: 150 } + NumberAnimation { target: scaleTransform; property: "xScale"; to: 0.4; duration: 150 } + NumberAnimation { target: chrome; property: "opacity"; to: chrome.isChild ? 0 : 1; duration: 150 } + } + NumberAnimation { target: scaleTransform; property: "xScale"; to: 0; duration: 150 } + ScriptAction { script: destroyAnimationFinished() } + } + // ![destruction] + transform: [ Scale { id: scaleTransform @@ -71,6 +85,7 @@ ShellSurfaceItem { } ] + // ![activation] Connections { target: shellSurface.toplevel !== undefined ? shellSurface.toplevel : null @@ -84,18 +99,6 @@ ShellSurfaceItem { } } - SequentialAnimation { - id: destroyAnimation - - ParallelAnimation { - NumberAnimation { target: scaleTransform; property: "yScale"; to: 2/height; duration: 150 } - NumberAnimation { target: scaleTransform; property: "xScale"; to: 0.4; duration: 150 } - NumberAnimation { target: chrome; property: "opacity"; to: chrome.isChild ? 0 : 1; duration: 150 } - } - NumberAnimation { target: scaleTransform; property: "xScale"; to: 0; duration: 150 } - ScriptAction { script: destroyAnimationFinished() } - } - SequentialAnimation { id: receivedFocusAnimation @@ -108,4 +111,5 @@ ShellSurfaceItem { NumberAnimation { target: scaleTransform; property: "xScale"; to: 1; duration: 100; easing.type: Easing.InOutQuad } } } + // ![activation] } diff --git a/examples/wayland/pure-qml/qml/CompositorScreen.qml b/examples/wayland/pure-qml/qml/CompositorScreen.qml index 79dee6a2f..ba61f2053 100644 --- a/examples/wayland/pure-qml/qml/CompositorScreen.qml +++ b/examples/wayland/pure-qml/qml/CompositorScreen.qml @@ -58,9 +58,11 @@ WaylandOutput { property ListModel shellSurfaces: ListModel {} property bool isNestedCompositor: Qt.platform.pluginName.startsWith("wayland") || Qt.platform.pluginName === "xcb" + // ![handleShellSurface] function handleShellSurface(shellSurface) { shellSurfaces.append({shellSurface: shellSurface}); } + // ![handleShellSurface] // During development, it can be useful to start the compositor inside X11 or // another Wayland compositor. In such cases, set sizeFollowsWindow to true to @@ -91,6 +93,7 @@ WaylandOutput { source: "qrc:/images/background.jpg" smooth: true + // ![repeater] Repeater { model: output.shellSurfaces // Chrome displays a shell surface on the screen (See Chrome.qml) @@ -99,13 +102,16 @@ WaylandOutput { onDestroyAnimationFinished: output.shellSurfaces.remove(index) } } + // ![repeater] } // Virtual Keyboard + // ![keyboard] Loader { anchors.fill: parent source: "Keyboard.qml" } + // ![keyboard] // Draws the mouse cursor for a given Wayland seat WaylandCursorItem { diff --git a/examples/wayland/pure-qml/qml/Keyboard.qml b/examples/wayland/pure-qml/qml/Keyboard.qml index 9f336e942..aedc6e620 100644 --- a/examples/wayland/pure-qml/qml/Keyboard.qml +++ b/examples/wayland/pure-qml/qml/Keyboard.qml @@ -48,6 +48,7 @@ ** ****************************************************************************/ +// ![keyboard] import QtQuick import QtQuick.VirtualKeyboard @@ -57,4 +58,5 @@ InputPanel { anchors.left: parent.left anchors.right: parent.right } +// ![keyboard] diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml index dffb81b3e..5a0f324ec 100644 --- a/examples/wayland/pure-qml/qml/main.qml +++ b/examples/wayland/pure-qml/qml/main.qml @@ -59,6 +59,7 @@ WaylandCompositor { CompositorScreen { id: screen; compositor: waylandCompositor } + // ![shell extensions] // Shell surface extension. Needed to provide a window concept for Wayland clients. // I.e. requests and events for maximization, minimization, resizing, closing etc. XdgShell { @@ -74,7 +75,10 @@ WaylandCompositor { WlShell { onWlShellSurfaceCreated: screen.handleShellSurface(shellSurface) } + // ![shell extensions] // Extension for Input Method (QT_IM_MODULE) support at compositor-side + // ![text input] QtTextInputMethodManager {} + // ![text input] } -- cgit v1.2.3