Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
camera.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4// Camera snippets
5// Extracted from src/multimedia/doc/snippets/multimedia-snippets/camera.cpp
6#include "qcamera.h"
7#include "qvideowidget.h"
8#include "qimagecapture.h"
9
10/* Globals so that everything is consistent. */
14
16{
18 QMediaCaptureSession captureSession;
19 camera = new QCamera;
20 captureSession.setCamera(camera);
21
24 captureSession.setVideoOutput(viewfinder);
25
27 captureSession.setImageCapture(imageCapture);
28
29 camera->start();
31
33 //on shutter button pressed
36}
37
The QCamera class provides interface for system camera devices.
Definition qcamera.h:28
void start()
\qmlmethod void Camera::start()
Definition qcamera.h:204
\inmodule QtMultimedia
int capture()
Capture the image and make it available as a QImage.
The QMediaCaptureSession class allows capturing of audio and video content.
void setCamera(QCamera *camera)
void setVideoOutput(QObject *output)
Sets a QObject, (output), to a video preview for the capture session.
void setImageCapture(QImageCapture *imageCapture)
The QVideoWidget class provides a widget which presents video produced by a media object.
void show()
Shows the widget and its child widgets.
Definition qwidget.cpp:7956
QVideoWidget * viewfinder
Definition camera.cpp:22
QCamera * camera
Definition camera.cpp:19
QImageCapture * imageCapture
Definition camera.cpp:21
void camera_blah()
Definition camera.cpp:15