Moved image settings to constructor (before camera->start()).
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 5 Jul 2017 20:47:26 +0000 (22:47 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 5 Jul 2017 20:47:26 +0000 (22:47 +0200)
Now the program works with QT5.7.

qtapp/barcode2cash/mainwindow.cpp

index aa204873675b51c600811ec867449f170ae2b7c9..5b7e16a286d00f1623ea44dad5fb96821b8055e8 100644 (file)
@@ -26,6 +26,9 @@ MainWindow::MainWindow(QWidget *parent) :
         connect(imageCapture, SIGNAL(error(int,QCameraImageCapture::Error,QString)), SLOT(showCaptureError(int,QCameraImageCapture::Error,QString)));
         updateCameraInfo();
         connect(ui->pbCapture, SIGNAL(clicked()), SLOT(capture()));
+        QImageEncoderSettings imageSettings;
+        imageSettings.setCodec("image/jpeg");
+        imageCapture->setEncodingSettings(imageSettings);
         camera->start();
     }
 
@@ -47,9 +50,6 @@ void MainWindow::updateCameraInfo() {
 
 
 void MainWindow::capture() {
-    QImageEncoderSettings imageSettings;
-    imageSettings.setCodec("image/jpeg");
-    imageCapture->setEncodingSettings(imageSettings);
     camera->searchAndLock();
     imageCapture->capture("test.jpg");
     camera->unlock();