Unsolved QCamera, save capture to file issue
-
I am trying to save a capture to any destination but doesn't save and gives no error
could someone point me some way to save the image or I way to use CaptureToBuffer and load its content in a label?void camera::on_save_pushButton_clicked()
{
//works with QFileDialog
/auto filename = QFileDialog::getSaveFileName(this, "Capturar", "/tmp",
"Imagem (.jpg;.jpeg");
if (filename.isNull()){
return;
}/
mCameraImageCapture->setCaptureDestination(
QCameraImageCapture::CaptureToFile);
QImageEncoderSettings imageEncoderSettings;
imageEncoderSettings.setCodec("image/jpeg");
mCameraImageCapture->setEncodingSettings(imageEncoderSettings);
mCamera->setCaptureMode(QCamera::CaptureStillImage);
mCamera->start();
mCamera->searchAndLock();// not working
QString filename = QCoreApplication::applicationDirPath() + "/imagetest.jpg";
mCameraImageCapture->capture(filename)mCamera->unlock();
}
-
@killown You should connect a slot to http://doc.qt.io/qt-5/qcameraimagecapture.html#error and check whether this signal is emitted and if so what the error is (http://doc.qt.io/qt-5/qcameraimagecapture.html#errorString).
-
@jsulm https://doc.qt.io/qt-5/qtmultimedia-multimediawidgets-camera-example.html I am using this example and it's working, thanks for reply!