And*_*eas 5 qt android qml android-camera qtquick2
如何Camera在Android上关注QML ?我已经尝试了所有focusMode但没有任何作用.相机应用正确关注我的设备.
这是我的QML文件:
import QtQuick 2.3
import QtMultimedia 5.2
Item {
property int scanerButtonWidth: 80
property int scanerButtonHeight: 60
Rectangle {
width: parent.width
height: scanerButtonHeight + 10
color: Qt.rgba(0,0,0,1)
}
VideoOutput {
width: parent.width
height: parent.height
source: camera
anchors.fill: parent
autoOrientation: true
}
Camera {
id: camera
imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash
captureMode: Camera.CaptureStillImage
exposure {
exposureMode: Camera.ExposureAuto
}
focus {
focusMode: Camera.FocusContinuous
focusPointMode: Camera.FocusPointCenter
}
imageCapture {
onImageCaptured: {
otpGeneratorApp.scanedQR_Code( preview, false, type )
qrCodeScanner.visible = false
}
}
}
Rectangle {
width: parent.width
height: scanerButtonHeight + 10
y: parent.height - ( height )
color: Qt.rgba(0,0,0,1)
Button {
id: captureButton;
width: scanerButtonWidth;
height: scanerButtonHeight;
x: parent.width * 0.5 - ( width / 2);
y: parent.height - ( height + 5);
text: qsTr( "[O]" );
onClicked: {
camera.imageCapture.capture();
}
}
Button {
id: focus
width: scanerButtonWidth;
height: scanerButtonHeight;
text: qsTr("Focus");
x: captureButton.x + ( captureButton.width + 10 );
y: parent.height - ( height + 5);
onClicked: {
camera.searchAndLock();
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1211 次 |
| 最近记录: |