Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgraphicsframecapture.cpp
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// Qt-Security score:significant reason:default
4
6#if (defined (Q_OS_WIN) || defined(Q_OS_LINUX)) && QT_CONFIG(library)
7#include "qgraphicsframecapturerenderdoc_p_p.h"
8#elif QT_CONFIG(metal)
9#include "qgraphicsframecapturemetal_p_p.h"
10#else
12#endif
13
14#include <QtCore/qstandardpaths.h>
15#include <QtCore/qcoreapplication.h>
16
18
19QGraphicsFrameCapturePrivate::QGraphicsFrameCapturePrivate()
20 : m_capturePath(QStandardPaths::writableLocation(QStandardPaths::TempLocation) +
21 QStringLiteral("/") + QCoreApplication::applicationName() +
22 QStringLiteral("/captures")),
23 m_capturePrefix(QCoreApplication::applicationName())
24{
25
26}
27
28QGraphicsFrameCapture::QGraphicsFrameCapture()
29{
30#if (defined (Q_OS_WIN) || defined(Q_OS_LINUX)) && QT_CONFIG(library)
31 d.reset(new QGraphicsFrameCaptureRenderDoc);
32#elif QT_CONFIG(metal)
33 d.reset(new QGraphicsFrameCaptureMetal);
34#endif
35}
36
37QGraphicsFrameCapture::~QGraphicsFrameCapture()
38{
39
40}
41
42void QGraphicsFrameCapture::setRhi(QRhi *rhi)
43{
44 if (!d.isNull())
45 d->setRhi(rhi);
46}
47
48void QGraphicsFrameCapture::startCaptureFrame()
49{
50 if (!d.isNull())
51 d->startCaptureFrame();
52}
53
54void QGraphicsFrameCapture::endCaptureFrame()
55{
56 if (!d.isNull())
57 d->endCaptureFrame();
58}
59
60QString QGraphicsFrameCapture::capturePath() const
61{
62 if (!d.isNull())
63 return d->capturePath();
64 return QString();
65}
66
67void QGraphicsFrameCapture::setCapturePath(const QString &path)
68{
69 if (!d.isNull())
70 d->setCapturePath(path);
71}
72
73QString QGraphicsFrameCapture::capturePrefix() const
74{
75 if (!d.isNull())
76 return d->capturePrefix();
77 return QString();
78}
79
80void QGraphicsFrameCapture::setCapturePrefix(const QString &prefix)
81{
82 if (!d.isNull())
83 d->setCapturePrefix(prefix);
84}
85
86QString QGraphicsFrameCapture::capturedFileName()
87{
88 if (!d.isNull())
89 return d->capturedFileName();
90
91 return QString();
92}
93
94QStringList QGraphicsFrameCapture::capturedFilesNames()
95{
96 if (!d.isNull())
97 return d->capturedFilesNames();
98
99 return QStringList();
100}
101
102bool QGraphicsFrameCapture::isLoaded() const
103{
104 if (!d.isNull())
105 return d->initialized();
106
107 return false;
108}
109
110bool QGraphicsFrameCapture::isCapturing() const
111{
112 if (!d.isNull())
113 return d->isCapturing();
114
115 return false;
116}
117
118void QGraphicsFrameCapture::openCapture() const
119{
120 if (!d.isNull())
121 d->openCapture();
122}
123
124QT_END_NAMESPACE