Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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; }
31 QImage::Format format() const override { return QImage::Format_RGB32; }
32 QDpi logicalDpi() const override { return QDpi(m_logicalDpi, m_logicalDpi); }
34 qreal devicePixelRatio() const override { return m_dpr; }
35 QString name() const override { return m_name; }
36 QPlatformCursor *cursor() const override { return m_cursor.data(); }
37 QList<QPlatformScreen *> virtualSiblings() const override;
38
39 QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
40
42
43public:
46 int m_logicalDpi = 96;
49 QScopedPointer<QPlatformCursor> m_cursor;
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:
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
72 QPixmap grabWindow(WId window, const QRect &rect) const;
73 QImage toImage() const override { return m_image; }
74
76
77private:
78 void clearHash();
79
80 QImage m_image;
81 QHash<WId, QRect> m_windowAreaHash;
82
83 static QHash<WId, QOffscreenBackingStore *> m_backingStoreForWinIdHash;
84};
85
99
101
102#endif
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtGui
Definition qdrag.h:22
\inmodule QtGui
Definition qimage.h:37
Format
The following image formats are available in Qt.
Definition qimage.h:41
@ Format_RGB32
Definition qimage.h:46
\inmodule QtCore\reentrant
Definition qjsonobject.h:20
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.
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 * 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.
qreal devicePixelRatio() const override
Reimplement this function in subclass to return the device pixel ratio for the screen.
QPlatformCursor * cursor() const override
Reimplement this function in subclass to return the cursor of the screen.
QString name() const override
QList< QPlatformScreen * > virtualSiblings() const override
Returns a list of all the platform screens that are part of the same virtual desktop.
QDpi logicalDpi() const override
Reimplement this function in subclass to return the logical horizontal and vertical dots per inch met...
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
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
QDpi logicalBaseDpi() const override
Reimplement to return the base logical DPI for the platform.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
The QPlatformBackingStore class provides the drawing area for top-level windows.
QWindow * window() const
Returns a pointer to the top-level window associated with this surface.
The QPlatformCursor class provides information about pointer device events (movement,...
The QPlatformDrag class provides an abstraction for drag.
The QPlatformNativeInterface class provides an abstraction for retrieving native resource handles.
The QPlatformScreen class provides an abstraction for visual displays.
The QPlatformWindow class provides an abstraction for top-level windows.
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
T * data() const noexcept
Returns the value of the pointer referenced by this object.
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtGui
Definition qwindow.h:63
rect
[4]
Combined button and popup list for selecting options.
DropAction
@ IgnoreAction
QPair< qreal, qreal > QDpi
static int area(const QSize &s)
Definition qicon.cpp:153
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei width
GLenum GLuint GLintptr offset
GLint y
double qreal
Definition qtypes.h:187
aWidget window() -> setWindowTitle("New Window Title")
[2]