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. */
11
QCamera
*
camera
= 0;
12
QImageCapture
*
imageCapture
= 0;
13
QVideoWidget
*
viewfinder
= 0;
14
15
void
camera_blah
()
16
{
18
QMediaCaptureSession
captureSession;
19
camera
=
new
QCamera
;
20
captureSession.
setCamera
(
camera
);
21
22
viewfinder
=
new
QVideoWidget
();
23
viewfinder
->
show
();
24
captureSession.
setVideoOutput
(
viewfinder
);
25
26
imageCapture
=
new
QImageCapture
;
27
captureSession.
setImageCapture
(
imageCapture
);
28
29
camera
->
start
();
31
33
//on shutter button pressed
34
imageCapture
->
capture
();
36
}
37
QCamera
The QCamera class provides interface for system camera devices.
Definition
qcamera.h:28
QCamera::start
void start()
\qmlmethod void Camera::start()
Definition
qcamera.h:204
QImageCapture
\inmodule QtMultimedia
Definition
qimagecapture.h:26
QImageCapture::capture
int capture()
Capture the image and make it available as a QImage.
Definition
qimagecapture.cpp:298
QMediaCaptureSession
The QMediaCaptureSession class allows capturing of audio and video content.
Definition
qmediacapturesession.h:25
QMediaCaptureSession::setCamera
void setCamera(QCamera *camera)
Definition
qmediacapturesession.cpp:222
QMediaCaptureSession::setVideoOutput
void setVideoOutput(QObject *output)
Sets a QObject, (output), to a video preview for the capture session.
Definition
qmediacapturesession.cpp:458
QMediaCaptureSession::setImageCapture
void setImageCapture(QImageCapture *imageCapture)
Definition
qmediacapturesession.cpp:362
QVideoWidget
The QVideoWidget class provides a widget which presents video produced by a media object.
Definition
qvideowidget.h:17
QWidget::show
void show()
Shows the widget and its child widgets.
Definition
qwidget.cpp:7956
viewfinder
QVideoWidget * viewfinder
Definition
camera.cpp:22
camera
QCamera * camera
Definition
camera.cpp:19
imageCapture
QImageCapture * imageCapture
Definition
camera.cpp:21
camera_blah
void camera_blah()
Definition
camera.cpp:15
qcamera.h
qimagecapture.h
qvideowidget.h
qtmultimedia
src
multimediawidgets
doc
snippets
multimedia-snippets
camera.cpp
Generated by
1.9.7