Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qscreencapture.h
Go to the documentation of this file.
1// Copyright (C) 2022 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#ifndef QSCREENCAPTURE_H
5#define QSCREENCAPTURE_H
6
7#include <QtCore/qobject.h>
8#include <QtCore/qnamespace.h>
9#include <QtGui/qscreen.h>
10#include <QtGui/qwindow.h>
11#include <QtGui/qwindowdefs.h>
12#include <QtMultimedia/qtmultimediaglobal.h>
13
15
19
20class Q_MULTIMEDIA_EXPORT QScreenCapture : public QObject
21{
23 Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
24 Q_PROPERTY(QScreen *screen READ screen WRITE setScreen NOTIFY screenChanged)
25 Q_PROPERTY(Error error READ error NOTIFY errorChanged)
26 Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
27
28public:
29 enum Error {
31 InternalError = 1,
32 CapturingNotSupported = 2,
33 CaptureFailed = 4,
34 NotFound = 5,
35 };
37
38 explicit QScreenCapture(QObject *parent = nullptr);
39 ~QScreenCapture() override;
40
41 QMediaCaptureSession *captureSession() const;
42
43 void setScreen(QScreen *screen);
44 QScreen *screen() const;
45
46 bool isActive() const;
47
48 Error error() const;
49 QString errorString() const;
50
51public Q_SLOTS:
52 void setActive(bool active);
53 void start() { setActive(true); }
54 void stop() { setActive(false); }
55
57 void activeChanged(bool);
61
62private:
63 void setCaptureSession(QMediaCaptureSession *captureSession);
64 QPlatformSurfaceCapture *platformScreenCapture() const;
66 Q_DISABLE_COPY(QScreenCapture)
67 Q_DECLARE_PRIVATE(QScreenCapture)
68};
69
71
72#endif // QSCREENCAPTURE_H
bool isActive
The QMediaCaptureSession class allows capturing of audio and video content.
\inmodule QtCore
Definition qobject.h:103
\inmodule QtMultimedia
void errorOccurred(QScreenCapture::Error error, const QString &errorString)
Signals when an error occurs, along with the errorString.
void screenChanged(QScreen *)
Error
Enumerates error codes that can be signaled by the QScreenCapture class.
void activeChanged(bool)
void stop()
Stops screen capture.
void start()
Starts screen capture.
void errorChanged()
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
@ NoError
Definition main.cpp:34
QScreen * screen
[1]
Definition main.cpp:29
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS