I am new at the QtMultimedia 5.x QML interface, but I tried this super simple QCamera demo below and it worked perfectly. It sees the camera and displays the viewfinder for me. This is the basis for an app I am developing.
However my system has two cameras. I am wondering if there is an API for selecting which physical camera to use. I see the availableDevices() method on the C++ object but I have to admin I am not connecting this to any selection mechanism.
I don’t need a chooser, I can hard code an index into a list of available cameras for a demo….
Thanks in advance!!
import QtQuick 2.0
import QtMultimedia 5.0
Item {
width: 640
height: 360
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
}
}
↧