我在其中一个qml相机教程中尝试了这个例子。
通过" cheese"检测相机,但未通过此代码显示。
此代码导致" defaultServiceProvider :: requestService():找不到 - " org.qt-project.qt.camera"
的服务使用Qt 5.4和QtGstreamer 1.2
我应该研究什么?
import QtQuick 2.1
import QtQuick.Window 2.2
import QtMultimedia 5.4
Window
{
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Camera {
id: camera
imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash
exposure {
exposureCompensation: -1.0
exposureMode: Camera.ExposurePortrait
}
flash.mode: Camera.FlashRedEyeReduction
imageCapture {
onImageCaptured: {
photoPreview.source = preview // Show the preview in an Image
}
}
}
VideoOutput {
source: camera
anchors.fill: parent
focus : visible // to receive focus and capture key events when visible
}
Image {
id: photoPreview
}
}