Skip to content
Snippets Groups Projects

QDS-11412 Implement built-in QR code reader

Merged Burak Hançerli requested to merge QDS-11412/built-in-qr-code-reader into master
3 files
+ 46
3
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 35
1
@@ -26,13 +26,15 @@
#include "backend.h"
#include "qapplication.h"
#include <QCameraDevice>
#include <QDesktopServices>
#include <QFileInfo>
#include <QJsonArray>
#include <QJsonObject>
#include <QMediaDevices>
#include <QSettings>
#include <QSslSocket>
#include <QVideoSink>
Backend::Backend(QObject *parent)
: QObject(parent)
@@ -76,6 +78,38 @@ void Backend::initialize()
// Check if updateInBackground is enabled
updateInBackground(settings.value("system/updateInBackground").toBool());
qDebug() << "Initialization complete";
m_camera = new QCamera(QMediaDevices::videoInputs().at(0));
for (const QCameraFormat &fmt : QMediaDevices::videoInputs().at(0).videoFormats()) {
qDebug() << "======================";
qDebug() << "max framerate:" << fmt.maxFrameRate();
qDebug() << "min framerate:" << fmt.minFrameRate();
qDebug() << "pix fmt:" << fmt.pixelFormat();
qDebug() << "res:" << fmt.resolution();
}
m_imageCapture = new QImageCapture;
m_camera->setFocusMode(QCamera::FocusModeAuto);
m_captureSession.setCamera(m_camera);
m_captureSession.setVideoOutput(&m_videoWidget);
m_captureSession.videoSink();
m_captureSession.setImageCapture(m_imageCapture);
connect(m_captureSession.videoSink(),
&QVideoSink::videoFrameChanged,
this,
[&](const QVideoFrame &frame) {
qDebug() << "Video frame changed";
QImage image = frame.toImage();
qDebug() << "Image captured";
});
// m_videoWidget.show();
// m_camera->start();
//on shutter button pressed
// m_imageCapture->capture();
}
void Backend::updateInBackground(const bool &enabled)
Loading