C
Qt VNC 服务器 - 远程桌面示例
// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import QtQuick import QtWayland.Compositor import QtWayland.Compositor.XdgShell import QtWayland.Compositor.WlShell import QtWayland.Compositor.IviApplication import QtVncServer WaylandCompositor { WaylandOutput { sizeFollowsWindow: true window: Window { width: 1024 height: 768 visible: true VncItem { id: vncItem anchors.fill: parent Rectangle { id: sourceRect anchors.fill: parent color: "steelblue" Repeater { model: shellSurfaces ShellSurfaceItem { shellSurface: modelData onSurfaceDestroyed: shellSurfaces.remove(index) } } Rectangle { id: connectedIndicator visible: vncItem.serverState === VncItem.Connected x: 10 y: 10 width: 30 height: 30 radius: 15 color: "red" } } } } } WlShell { onWlShellSurfaceCreated: shellSurfaces.append({shellSurface: shellSurface}); } XdgShell { onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface}); } IviApplication { onIviSurfaceCreated: { shellSurfaces.append({shellSurface: iviSurface}); } } ListModel { id: shellSurfaces } }