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
qquickwindowcapture.cpp
Go to the documentation of this file.
1// Copyright (C) 2025 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
5
7
8static qreal windowFrameRateToReal(std::optional<qreal> frameRate)
9{
10 return frameRate.value_or(-1.f);
11}
12
13QQuickWindowCapture::QQuickWindowCapture(QObject *parent) : QWindowCapture(parent)
14{
15}
16
17/*!
18 \since 6.12
19 \qmlproperty real QtMultimedia::WindowCapture::maximumFrameRate
20
21 The window capture frame rate upper limit.
22
23 This can be set to override the capture frame rate used by default based on
24 e.g. display refresh rate, but only as an upper limit since window capture
25 produces frames at a variable rate. Setting this higher than the display
26 refresh rate is not recommended and can cause errors.
27
28 If -1, a platform-dependent default is used.
29
30 Any changes to this property are applied the next time the WindowCapture
31 goes active.
32*/
33
34void QQuickWindowCapture::qmlSetMaximumFrameRate(qreal frameRate)
35{
36 if (qFuzzyCompare(frameRate, static_cast<qreal>(-1.f)))
37 setMaximumFrameRate(std::nullopt);
38 else if (frameRate > 0.f)
39 setMaximumFrameRate(frameRate);
40}
41
42qreal QQuickWindowCapture::qmlMaximumFrameRate() const
43{
44 return windowFrameRateToReal(maximumFrameRate());
45}
46
47void QQuickWindowCapture::qmlResetMaximumFrameRate()
48{
49 setMaximumFrameRate(std::nullopt);
50}
51
52QT_END_NAMESPACE
53
54#include "moc_qquickwindowcapture_p.cpp"
Combined button and popup list for selecting options.
static QT_BEGIN_NAMESPACE qreal windowFrameRateToReal(std::optional< qreal > frameRate)