这是我运行的代码。它什么都没有显示根本没有QML窗口。
我注意到当我评论VideoOuput
部分代码时,窗口显示为红色矩形。
此代码在笔记本电脑上运行良好,但在桌面上甚至无法显示启动窗口。桌面没有连接相机,但我确实希望程序启动并显示基本窗口。
import QtQuick 2.4
import QtQuick.Window 2.2
import QtMultimedia 5.5
Window
{
visible: true
Component.onCompleted: camera.start()
Rectangle
{
color: "red"
width: 640
height: 360
Camera
{
id: camera;
}
VideoOutput
{
source: camera
anchors.fill: parent
focus : visible // to receive focus and capture key events when visible
}
}
}
在 Ubuntu 14.04.3 上运行。
这是一台USB摄像头,正在我的电脑上检测到
我可以通过xawtv -c /dev/video0
看到它正常工作。
我错过了什么?