我想在Android中使用带有Qml界面和QtMultimedia 5.0的相机 到目前为止,我还没有成功。
我正在使用qt 5.1和qtquick 2.1以及Android 4.2.2 API 17
这是我的代码:
main.qml:
import QtQuick 2.1
import QtMultimedia 5.0
Rectangle {
width: 800
height: 1280
color:'green'
Camera {
id: camera
imageCapture {
onImageCaptured: {
// Show the preview in an Image
photoPreview.source = preview
}
onImageSaved: {
text.text = qsTr("Last Captured Image (%1):").arg(camera.imageCapture.capturedImagePath)
}
}
}
Column {
Text {
height: 15
text: qsTr("Preview (Click to capture):")
}
VideoOutput {
source: camera
focus: visible // To receive focus and capture key events when visible
width: 320; height: 240
MouseArea {
anchors.fill: parent
onClicked: camera.imageCapture.capture()
}
}
Text {
id: text
height: 15
text: qsTr("Last Captured Image (none)")
}
Image {
id: photoPreview
width: 320; height: 240
}
}
}
在AndroidManifest.xml文件中我添加了:
<uses-feature android:name="android.hardware.camera" />
我得到的是白屏
先谢谢