Skip to content

Commit f2ada3e

Browse files
committed
Add small documentation tidbits for screen grabbers
Some explanation for the abstract class and various implementations that should help other people in the future.
1 parent 841948f commit f2ada3e

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

plugins/quickinspector/quickscreengrabber.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,7 @@ UnsupportedScreenGrabber::UnsupportedScreenGrabber(QQuickWindow *window)
797797
{
798798
}
799799

800-
UnsupportedScreenGrabber::~UnsupportedScreenGrabber()
801-
{
802-
}
800+
UnsupportedScreenGrabber::~UnsupportedScreenGrabber() = default;
803801

804802
void UnsupportedScreenGrabber::requestGrabWindow(const QRectF & /*userViewport*/)
805803
{
@@ -832,8 +830,10 @@ void UnsupportedScreenGrabber::requestGrabWindow(const QRectF & /*userViewport*/
832830

833831
void UnsupportedScreenGrabber::drawDecorations()
834832
{
833+
// Intentionally dummied out because this grabber doesn't do anything useful
835834
}
836835

837836
void UnsupportedScreenGrabber::updateOverlay()
838837
{
838+
// Intentionally dummied out because this grabber doesn't do anything useful
839839
}

plugins/quickinspector/quickscreengrabber.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ class GrabbedFrame
9494
QVector<QuickItemGeometry> itemsGeometry;
9595
};
9696

97+
/**
98+
* @brief Base for all screen grabbers that decorate and return a pixmap for the window.
99+
*/
97100
class AbstractScreenGrabber : public QObject
98101
{
99102
Q_OBJECT
@@ -127,7 +130,13 @@ class AbstractScreenGrabber : public QObject
127130
explicit AbstractScreenGrabber(QQuickWindow *window);
128131
~AbstractScreenGrabber() override;
129132

133+
/**
134+
* @return The graphics API used to render @p window.
135+
*/
130136
static RenderInfo::GraphicsApi graphicsApiFor(QQuickWindow *window);
137+
/**
138+
* @return Screen grabber compatible with the given @p window.
139+
*/
131140
static std::unique_ptr<AbstractScreenGrabber> get(QQuickWindow *window);
132141

133142
QQuickWindow *window() const;
@@ -156,6 +165,9 @@ class AbstractScreenGrabber : public QObject
156165
void doDrawDecorations(QPainter &painter);
157166
void gatherRenderInfo();
158167

168+
/**
169+
* @brief Draw decorations on the target window.
170+
*/
159171
virtual void drawDecorations() = 0;
160172

161173
virtual void updateOverlay();
@@ -201,6 +213,9 @@ class OpenGLScreenGrabber : public AbstractScreenGrabber
201213
};
202214
#endif
203215

216+
/**
217+
* @brief Screen grabber meant for software rendering.
218+
*/
204219
class SoftwareScreenGrabber : public AbstractScreenGrabber
205220
{
206221
Q_OBJECT
@@ -222,6 +237,9 @@ class SoftwareScreenGrabber : public AbstractScreenGrabber
222237
QPointF m_lastItemPosition;
223238
};
224239

240+
/**
241+
* @brief Screen grabber used for unsupported rendering backends. Doesn't do anything useful otherwise.
242+
*/
225243
class UnsupportedScreenGrabber : public AbstractScreenGrabber
226244
{
227245
Q_OBJECT

0 commit comments

Comments
 (0)