【Qt QML】VideoOutput被Window覆盖,部署到远程Linux主机与在远程主机直接运行效果不一致

1. 问题

在Linux QML多媒体VideoOutput开发中遇到如下问题:

  • 程序功能:Camera采集视频,VideoOutput显示
  • 直接在Ubuntu Qt Creator中远程部署到开发板运行,显示正常。
  • 但是如果直接到开发板目录中运行,视频被window组件覆盖。
c 复制代码
import QtQuick 2.15
import QtQuick.Window 2.15
import QtMultimedia 5.15
import QtQuick.Controls 2.15

Window {
    width: 500
    height: 1000
    y: 200
    visible: true
    title: qsTr("Hello World")

    VideoOutput{
        width: 300
        height: 200
        fillMode: Image.PreserveAspectFit
        visible: true
        source: _mCamera
    }

    Camera{
        id: _mCamera
    }
}

2. 解决方案

不知道什么原因,暂时的解决方案是用另一个window组件包裹VideoOutput,并将这个window组件的颜色设置为透明,代码如下:

c 复制代码
import QtQuick 2.15
import QtQuick.Window 2.15
import QtMultimedia 5.15
import QtQuick.Controls 2.15

Window {
    width: 500
    height: 1000
    y: 200
    visible: true
    title: qsTr("Hello World")

    Window {
            width: 400
            height: 500
            visible: true
            color: "transparent"
            title: qsTr("Hello World")

            VideoOutput{
                width: 300
                height: 200
                fillMode: Image.PreserveAspectFit
                visible: true
                source: _mCamera
            }
    }


    Camera{
        id: _mCamera
    }
}
相关推荐
深紫色的三北六号1 小时前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash5 小时前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI15 小时前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行1 天前
Linux和window共享文件夹
linux
木心月转码ing2 天前
WSL+Cpp开发环境配置
linux
崔小汤呀3 天前
最全的docker安装笔记,包含CentOS和Ubuntu
linux·后端
何中应3 天前
vi编辑器使用
linux·后端·操作系统
何中应3 天前
Linux进程无法被kill
linux·后端·操作系统
何中应3 天前
rm-rf /命令操作介绍
linux·后端·操作系统
何中应3 天前
Linux常用命令
linux·操作系统