38 CapturingNotSupported = 2,
43 using ScreenSource = QPointer<QScreen>;
44 using WindowSource = QCapturableWindow;
46 using Source = std::variant<ScreenSource, WindowSource>;
48 explicit QPlatformSurfaceCapture(Source initialSource);
59 void setActive(
bool active) override;
60 bool isActive()
const override;
62 void setSource(Source source);
64 template<
typename Type>
66 Q_ASSERT(std::holds_alternative<Type>(m_source));
67 return *std::get_if<Type>(&m_source);
70 Source source()
const {
return m_source; }
73 QString errorString()
const final;
75 void setFrameRate(std::optional<qreal>);
76 [[nodiscard]] std::optional<qreal> frameRate()
const;
78 void setIgnoreCursor(
bool);
80 [[nodiscard]]
bool ignoreCursor()
const;
83 virtual bool setActiveInternal(
bool) = 0;
85 bool checkScreenWithError(ScreenSource &screen);
88 void updateError(Error error,
const QString &errorString);
91 void sourceChanged(WindowSource);
92 void sourceChanged(ScreenSource);
93 void errorOccurred(Error error, QString errorString);
94 void frameRateChanged(std::optional<qreal>);
97 std::optional<qreal> m_frameRate;
98 QErrorInfo<Error> m_error;
100 bool m_active =
false;
104 bool m_ignoreCursor =
false;