the availability of the camera
-
I have activated both cameras and you find below my code please I would like to identify each time which camera is available
for example:
if both cameras are available my interface will show me:
cameraAvant available
cameraArriere available
if the cameraAvant is not available the interface will tell me
cameraAvant is not available and cameraArriere available
how i can do it please
I made this code there but even if there is a camera is not available it tells me that:
cameraAvant available
cameraArriere availableif (QCameraInfo::availableCameras().count()>0) // compter les nombres des camera disponible
{
qDebug() << "Caméra disponible" << QCameraInfo::availableCameras().count();
cameraArriere = new QCamera("/dev/video0",this); // l'obtention de source de camera Avant
layoutArriere = new QVBoxLayout();
cameraArriere->setViewfinder(viewfinderArriere);
layoutArriere->addWidget(viewfinderArriere);
cameraArriere->start();
ui->label->setText("CameraArriere is available");cameraAvant = new QCamera("/dev/video2",this); // l'obtention de source de camera Arriere layoutAvant = new QVBoxLayout(); cameraAvant->setViewfinder(viewfinderAvant); layoutAvant->addWidget(viewfinderAvant); cameraAvant->start(); ui->label_4->setText("cameraAvant is available");
else {
QMessageBox::warning(this, " " , "Both camera not available");
} -
Either check if your
QCamera
object is valid or use the Qt signals and the camera status enum (the latter is probably the better way)