38 CapturingNotSupported = 2,
43 using ScreenSource = QPointer<QScreen>;
44 using WindowSource = QCapturableWindow;
46 using Source = std::variant<ScreenSource, WindowSource>;
48 explicit QPlatformSurfaceCapture(Source initialSource);
50 void setActive(
bool active) override;
51 bool isActive()
const override;
53 void setSource(Source source);
55 template<
typename Type>
57 Q_ASSERT(std::holds_alternative<Type>(m_source));
58 return *std::get_if<Type>(&m_source);
61 Source source()
const {
return m_source; }
64 QString errorString()
const final;
66 void setFrameRate(std::optional<qreal>);
67 [[nodiscard]] std::optional<qreal> frameRate()
const;
70 virtual bool setActiveInternal(
bool) = 0;
72 bool checkScreenWithError(ScreenSource &screen);
75 void updateError(Error error,
const QString &errorString);
78 void sourceChanged(WindowSource);
79 void sourceChanged(ScreenSource);
80 void errorOccurred(Error error, QString errorString);
81 void frameRateChanged();
84 std::optional<qreal> m_frameRate;
85 QErrorInfo<Error> m_error;
87 bool m_active =
false;