summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/wayland/ivi-compositor/main.qml2
-rw-r--r--examples/wayland/minimal-qml/main.qml2
-rw-r--r--examples/wayland/multi-screen/qml/Screen.qml13
-rw-r--r--examples/wayland/multi-screen/qml/main.qml56
-rw-r--r--examples/wayland/spanning-screens/main.qml12
5 files changed, 47 insertions, 38 deletions
diff --git a/examples/wayland/ivi-compositor/main.qml b/examples/wayland/ivi-compositor/main.qml
index 6535296b6..1f2420bf9 100644
--- a/examples/wayland/ivi-compositor/main.qml
+++ b/examples/wayland/ivi-compositor/main.qml
@@ -43,9 +43,7 @@ import QtWayland.Compositor 1.0
import QtQuick.Window 2.2
WaylandCompositor {
- id: wlcompositor
WaylandOutput {
- compositor: wlcompositor
sizeFollowsWindow: true
window: Window {
width: 1024
diff --git a/examples/wayland/minimal-qml/main.qml b/examples/wayland/minimal-qml/main.qml
index d44d0c6a1..732e2ccad 100644
--- a/examples/wayland/minimal-qml/main.qml
+++ b/examples/wayland/minimal-qml/main.qml
@@ -43,10 +43,8 @@ import QtQuick.Window 2.2
import QtWayland.Compositor 1.0
WaylandCompositor {
- id: wlcompositor
// The output defines the screen.
WaylandOutput {
- compositor: wlcompositor
sizeFollowsWindow: true
window: Window {
width: 1024
diff --git a/examples/wayland/multi-screen/qml/Screen.qml b/examples/wayland/multi-screen/qml/Screen.qml
index 7e2eb01dc..26132f754 100644
--- a/examples/wayland/multi-screen/qml/Screen.qml
+++ b/examples/wayland/multi-screen/qml/Screen.qml
@@ -40,18 +40,25 @@
import QtQuick 2.0
import QtWayland.Compositor 1.0
-import QtQuick.Window 2.2
+import QtQuick.Window 2.3
WaylandOutput {
id: screen
property variant viewsBySurface: ({})
property alias surfaceArea: background
property alias text: t.text
+ property alias targetScreen: win.targetScreen
sizeFollowsWindow: true
+ property bool windowed: false
+
window: Window {
- width: 1024
- height: 760
+ id: win
+ x: targetScreen.virtualX
+ y: targetScreen.virtualY
+ width: 800
+ height: 800
+ visibility: windowed ? Window.Windowed : Window.FullScreen
visible: true
WaylandMouseTracker {
diff --git a/examples/wayland/multi-screen/qml/main.qml b/examples/wayland/multi-screen/qml/main.qml
index 37350289e..25961c698 100644
--- a/examples/wayland/multi-screen/qml/main.qml
+++ b/examples/wayland/multi-screen/qml/main.qml
@@ -39,38 +39,37 @@
**
****************************************************************************/
+import QtQml 2.2
import QtQuick 2.0
+import QtQuick.Window 2.3 as Window
import QtWayland.Compositor 1.0
+import QtQml.Models 2.1
WaylandCompositor {
id: comp
- defaultOutput: middleScreen
- Screen {
- id: leftScreen
- position.x: -leftScreen.surfaceArea.width
- position.y: 0
- surfaceArea.color: "#f00"
- text: "Left"
- compositor: comp
+ ListModel {
+ id: emulatedScreens
+ ListElement { name: "left"; virtualX: 0; virtualY: 0; width: 800; height: 600 }
+ ListElement { name: "middle"; virtualX: 800; virtualY: 0; width: 800; height: 600 }
+ ListElement { name: "right"; virtualX: 1600; virtualY: 0; width: 800; height: 600 }
}
- Screen {
- id: middleScreen
- position.x: leftScreen.position.x + leftScreen.surfaceArea.width
- position.y: 0
- text: "Middle"
- surfaceArea.color: "#0f0"
- compositor: comp
- }
+ property bool emulated: Qt.application.screens.length < 2
+
+ Instantiator {
+ id: screens
+ model: emulated ? emulatedScreens : Qt.application.screens
- Screen {
- id: rightScreen
- position.x: middleScreen.position.x + middleScreen.surfaceArea.width
- position.y: 0
- surfaceArea.color: "#00f"
- text: "Right"
- compositor: comp
+ delegate: Screen {
+ surfaceArea.color: "lightsteelblue"
+ text: name
+ compositor: comp
+ targetScreen: modelData
+ Component.onCompleted: if (!comp.defaultOutput) comp.defaultOutput = this
+ position: Qt.point(virtualX, virtualY)
+ windowed: emulated
+ }
}
Component {
@@ -85,10 +84,6 @@ WaylandCompositor {
Item {
id: rootItem
- x: leftScreen.position.x
- y: leftScreen.position.y
- width: leftScreen.surfaceArea.width + middleScreen.surfaceArea.width + rightScreen.surfaceArea.width
- height: Math.max(leftScreen.surfaceArea.height, middleScreen.surfaceArea.height, rightScreen.surfaceArea.height)
}
WlShell {
@@ -117,11 +112,12 @@ WaylandCompositor {
function handleShellSurfaceCreated(shellSurface) {
var moveItem = moveItemComponent.createObject(rootItem, {
+ "x": screens.objectAt(0).position.x,
+ "y": screens.objectAt(0).position.y,
"width": Qt.binding(function() { return shellSurface.surface.width; }),
"height": Qt.binding(function() { return shellSurface.surface.height; })
});
- createShellSurfaceItem(shellSurface, moveItem, middleScreen);
- createShellSurfaceItem(shellSurface, moveItem, leftScreen);
- createShellSurfaceItem(shellSurface, moveItem, rightScreen);
+ for (var i = 0; i < screens.count; ++i)
+ createShellSurfaceItem(shellSurface, moveItem, screens.objectAt(i));
}
}
diff --git a/examples/wayland/spanning-screens/main.qml b/examples/wayland/spanning-screens/main.qml
index 32dc11f33..ae6815c9d 100644
--- a/examples/wayland/spanning-screens/main.qml
+++ b/examples/wayland/spanning-screens/main.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.6
-import QtQuick.Window 2.2
+import QtQuick.Window 2.3
import QtWayland.Compositor 1.0
WaylandCompositor {
@@ -55,6 +55,11 @@ WaylandCompositor {
visible: true
color: "#1337af"
Text { text: "Top screen" }
+
+ // Enable the following to make the output target an actual screen,
+ // for example when running on eglfs in a multi-display embedded system.
+
+ // targetScreen: Qt.application.screens[0]
}
}
@@ -68,6 +73,11 @@ WaylandCompositor {
visible: true
color: "#1abacc"
Text { text: "Bottom screen" }
+
+ // Enable the following to make the output target an actual screen,
+ // for example when running on eglfs in a multi-display embedded system.
+
+ // targetScreen: Qt.application.screens[1]
}
}