【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
    }
}
相关推荐
wj3055853787 小时前
课程 9:模型测试记录与 Prompt 策略
linux·人工智能·python·comfyui
为何创造硅基生物7 小时前
C语言 结构体内存对齐规则(通俗易懂版)
c语言·开发语言
吃好睡好便好7 小时前
在Matlab中绘制横直方图
开发语言·学习·算法·matlab
星寂樱易李7 小时前
iperf3 + Python-- 网络带宽、网速、网络稳定性
开发语言·网络·python
abigriver7 小时前
打造 Linux 离线大模型级语音输入法:Whisper.cpp + 3090 显卡加速与 Rime 中英混输终极调优指南
linux·运维·whisper
仰泳之鹅7 小时前
【C语言】自定义数据类型2——联合体与枚举
c语言·开发语言·算法
wangqiaowq8 小时前
windows下nginx的安装
linux·服务器·前端
之歆8 小时前
DAY_12JavaScript DOM 完全指南(二):实战与性能篇
开发语言·前端·javascript·ecmascript
YYRAN_ZZU8 小时前
Petalinux新建自动脚本启动
linux
charlie1145141918 小时前
嵌入式Linux驱动开发pinctrl篇(1)——从寄存器到子系统:驱动演进之路
linux·运维·驱动开发