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
qwindowcapture.h
Go to the documentation of this file.
1// Copyright (C) 2023 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 QWINDOWCAPTURE_H
5#define QWINDOWCAPTURE_H
6
7#include <QtMultimedia/qtmultimediaexports.h>
8#include <QtMultimedia/qcapturablewindow.h>
9#include <QtCore/qobject.h>
10#include <QtCore/qlist.h>
11
13
15
16class Q_MULTIMEDIA_EXPORT QWindowCapture : public QObject
17{
19 Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
20 Q_PROPERTY(QCapturableWindow window READ window WRITE setWindow NOTIFY windowChanged)
21 Q_PROPERTY(Error error READ error NOTIFY errorChanged)
22 Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
23public:
24 enum Error {
26 InternalError = 1,
27 CapturingNotSupported = 2,
28 CaptureFailed = 4,
29 NotFound = 5,
30 };
32
33 explicit QWindowCapture(QObject *parent = nullptr);
34 ~QWindowCapture() override;
35
36 Q_INVOKABLE static QList<QCapturableWindow> capturableWindows();
37
38 QMediaCaptureSession *captureSession() const;
39
40 void setWindow(QCapturableWindow window);
41
43
44 bool isActive() const;
45
46 Error error() const;
47 QString errorString() const;
48
49public Q_SLOTS:
50 void setActive(bool active);
51 void start() { setActive(true); }
52 void stop() { setActive(false); }
53
55 void activeChanged(bool);
59
60private:
61 void setCaptureSession(QMediaCaptureSession *captureSession);
62 QPlatformSurfaceCapture *platformWindowCapture() const;
63
65 Q_DISABLE_COPY(QWindowCapture)
66 Q_DECLARE_PRIVATE(QWindowCapture)
67};
68
70
71#endif // QWINDOWCAPTURE_H
bool isActive
\inmodule QtMultimedia
The QMediaCaptureSession class allows capturing of audio and video content.
\inmodule QtCore
Definition qobject.h:103
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtMultimedia
void start()
\qmlmethod QtMultimedia::WindowCapture::start
void errorChanged()
void windowChanged(QCapturableWindow window)
Error
\qmltype WindowCapture \instantiates QWindowCapture \inqmlmodule QtMultimedia
void errorOccurred(QWindowCapture::Error error, const QString &errorString)
Signals when an error occurs, along with the errorString.
void activeChanged(bool)
void stop()
\qmlmethod QtMultimedia::WindowCapture::stop
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
@ NoError
Definition main.cpp:34
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_SIGNALS
aWidget window() -> setWindowTitle("New Window Title")
[2]