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