summaryrefslogtreecommitdiffstats
path: root/examples/wayland/pure-qml/qml
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-05-11 12:44:34 +0200
committerPaul Olav Tvete <paul.tvete@qt.io>2021-08-13 14:34:56 +0200
commitea929b6fa5a90602e6f1fb597e3edfed9e6de3a7 (patch)
treef43077aca5e1c42f5688378d0902ef8e3c4cb7e3 /examples/wayland/pure-qml/qml
parent12401c6f116f26e38182c90dc6920e4610f0e90d (diff)
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 <paul.tvete@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'examples/wayland/pure-qml/qml')
-rw-r--r--examples/wayland/pure-qml/qml/Chrome.qml28
-rw-r--r--examples/wayland/pure-qml/qml/CompositorScreen.qml6
-rw-r--r--examples/wayland/pure-qml/qml/Keyboard.qml2
-rw-r--r--examples/wayland/pure-qml/qml/main.qml4
4 files changed, 28 insertions, 12 deletions
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
@@ -85,18 +100,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
ParallelAnimation {
@@ -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]
}