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
qoffscreencommon.h
Go to the documentation of this file.
1// Copyright (C) 2016 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
4#ifndef QOFFSCREENCOMMON_H
5#define QOFFSCREENCOMMON_H
6
7#include <qpa/qplatformbackingstore.h>
8#if QT_CONFIG(draganddrop)
9#include <qpa/qplatformdrag.h>
10#endif
11#include <qpa/qplatformintegration.h>
12#include <qpa/qplatformnativeinterface.h>
13#include <qpa/qplatformscreen.h>
14#include <qpa/qplatformwindow.h>
15
16#include <qscopedpointer.h>
17#include <qimage.h>
18#include <qjsonobject.h>
19#include <qhash.h>
20
22
25{
26public:
27 QOffscreenScreen(const QOffscreenIntegration *integration);
28
29 QRect geometry() const override { return m_geometry; }
30 int depth() const override { return 32; }
35 QString name() const override { return m_name; }
38
39 QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
40
42
43public:
46 int m_logicalDpi = 96;
51};
52
53#if QT_CONFIG(draganddrop)
54class QOffscreenDrag : public QPlatformDrag
55{
56public:
57 Qt::DropAction drag(QDrag *) override { return Qt::IgnoreAction; }
58};
59#endif
60
62{
63public:
64 QOffscreenBackingStore(QWindow *window);
66
67 QPaintDevice *paintDevice() override;
68 void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
69 void resize(const QSize &size, const QRegion &staticContents) override;
70 bool scroll(const QRegion &area, int dx, int dy) override;
71 void beginPaint(const QRegion &) override;
72
73 QPixmap grabWindow(WId window, const QRect &rect) const;
74 QImage toImage() const override { return m_image; }
75
77
78private:
79 void clearHash();
80
81 QImage m_image;
82 QHash<WId, QRect> m_windowAreaHash;
83
84 static QHash<WId, QOffscreenBackingStore *> m_backingStoreForWinIdHash;
85};
86
88{
89public:
92
93 static void setConfiguration(const QJsonObject &configuration, QOffscreenPlatformNativeInterface *iface);
95
96 void *nativeResourceForIntegration(const QByteArray &resource) override;
97private:
98 QOffscreenIntegration *m_integration;
99};
100
101QT_END_NAMESPACE
102
103#endif
bool scroll(const QRegion &area, int dx, int dy) override
Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative.
QImage toImage() const override
Implemented in subclasses to return the content of the backingstore as a QImage.
void beginPaint(const QRegion &) override
This function is called before painting onto the surface begins, with the region in which the paintin...
static QOffscreenBackingStore * backingStoreForWinId(WId id)
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override
Flushes the given region from the specified window.
void resize(const QSize &size, const QRegion &staticContents) override
QOffscreenBackingStore(QWindow *window)
QPaintDevice * paintDevice() override
Implement this function to return the appropriate paint device.
QPixmap grabWindow(WId window, const QRect &rect) const
void setPos(const QPoint &pos) override
QPoint pos() const override
void changeCursor(QCursor *windowCursor, QWindow *window) override
This method is called by Qt whenever the cursor graphic should be changed.
void * nativeResourceForIntegration(const QByteArray &resource) override
QOffscreenPlatformNativeInterface(QOffscreenIntegration *integration)
static QJsonObject configuration(QOffscreenPlatformNativeInterface *iface)
static void setConfiguration(const QJsonObject &configuration, QOffscreenPlatformNativeInterface *iface)
static QPlatformWindow * windowContainingCursor
QOffscreenScreen(const QOffscreenIntegration *integration)
QScopedPointer< QPlatformCursor > m_cursor
int depth() const override
Reimplement in subclass to return current depth of the screen.
QPixmap grabWindow(WId window, int x, int y, int width, int height) const override
This function is called when Qt needs to be able to grab the content of a window.
const QOffscreenIntegration * m_integration
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)