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
qwasmscreen.h
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWASMSCREEN_H
5#define QWASMSCREEN_H
6
7#include "qwasmcursor.h"
8
10
11#include <qpa/qplatformscreen.h>
12
13#include <QtCore/qscopedpointer.h>
14#include <QtCore/qtextstream.h>
15#include <QtCore/private/qstdweb_p.h>
16
17#include <emscripten/val.h>
18
20
22class QWasmWindow;
24class QWasmCompositor;
26class QOpenGLContext;
27
29{
31public:
32 QWasmScreen(const emscripten::val &containerOrCanvas);
34 void deleteScreen();
35
37 static QWasmScreen *get(QScreen *screen);
38 emscripten::val element() const;
39 QString eventTargetId() const;
40 QString outerScreenId() const;
41 QPointingDevice *touchDevice() { return m_touchDevice.get(); }
42 QPointingDevice *tabletDevice() { return m_tabletDevice.get(); }
43
45 QWasmDeadKeySupport *deadKeySupport() { return m_deadKeySupport.get(); }
46
47 QList<QWasmWindow *> allWindows();
48
49 QRect geometry() const override;
50 int depth() const override;
51 QImage::Format format() const override;
52 QDpi logicalDpi() const override;
53 qreal devicePixelRatio() const override;
54 QString name() const override;
55 QPlatformCursor *cursor() const override;
56
58 QWindow *topWindow() const;
59 QWindow *topLevelAt(const QPoint &p) const override;
60
61 // QWasmWindowTreeNode:
62 emscripten::val containerElement() final;
64
65 QPointF mapFromLocal(const QPointF &p) const;
66 QPointF clipPoint(const QPointF &p) const;
67
68 void invalidateSize();
72
73public slots:
74 void setGeometry(const QRect &rect);
75
77 // QWasmWindowTreeNode:
79 QWasmWindow *child) final;
80
81 emscripten::val m_container;
82 emscripten::val m_intermediateContainer;
83 emscripten::val m_shadowContainer;
84 std::unique_ptr<QWasmCompositor> m_compositor;
85 std::unique_ptr<QPointingDevice> m_touchDevice;
86 std::unique_ptr<QPointingDevice> m_tabletDevice;
87 std::unique_ptr<QWasmDeadKeySupport> m_deadKeySupport;
88 QRect m_geometry = QRect(0, 0, 100, 100);
89 int m_depth = 32;
90 QImage::Format m_format = QImage::Format_RGB32;
91 QWasmCursor m_cursor;
92 static const char *m_canvasResizeObserverCallbackContextPropertyName;
93 std::unique_ptr<qstdweb::EventCallback> m_onContextMenu;
94};
95
97#endif // QWASMSCREEN_H
\inmodule QtGui
Definition qimage.h:37
Format
The following image formats are available in Qt.
Definition qimage.h:41
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtGui
The QPlatformCursor class provides information about pointer device events (movement,...
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
The QPlatformScreen class provides an abstraction for visual displays.
QScreen * screen() const
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qpoint.h:25
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
\inmodule QtCore\reentrant
Definition qrect.h:30
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QWasmScreen * get(QPlatformScreen *screen)
QString name() const override
void installCanvasResizeObserver()
emscripten::val element() const
QPointF mapFromLocal(const QPointF &p) const
void deleteScreen()
QWindow * topLevelAt(const QPoint &p) const override
Return the given top level window for a given position.
void setGeometry(const QRect &rect)
QPointF clipPoint(const QPointF &p) const
QWasmCompositor * compositor()
void updateQScreenAndCanvasRenderSize()
QPlatformCursor * cursor() const override
Reimplement this function in subclass to return the cursor of the screen.
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
QWasmWindowTreeNode * parentNode() final
qreal devicePixelRatio() const override
Reimplement this function in subclass to return the device pixel ratio for the screen.
QWasmScreen(const emscripten::val &containerOrCanvas)
void resizeMaximizedWindows()
void onSubtreeChanged(QWasmWindowTreeNodeChangeType changeType, QWasmWindowTreeNode *parent, QWasmWindow *child) final
QString eventTargetId() const
QPointingDevice * touchDevice()
Definition qwasmscreen.h:41
void invalidateSize()
QPointingDevice * tabletDevice()
Definition qwasmscreen.h:42
QString outerScreenId() const
int depth() const override
Reimplement in subclass to return current depth of the screen.
QWindow * topWindow() const
QDpi logicalDpi() const override
Reimplement this function in subclass to return the logical horizontal and vertical dots per inch met...
QWasmDeadKeySupport * deadKeySupport()
Definition qwasmscreen.h:45
static void canvasResizeObserverCallback(emscripten::val entries, emscripten::val)
emscripten::val containerElement() final
QList< QWasmWindow * > allWindows()
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
\inmodule QtGui
Definition qwindow.h:63
Format
Definition ddsheader.h:14
rect
[4]
Combined button and popup list for selecting options.
QPair< qreal, qreal > QDpi
GLuint GLfloat * val
GLfloat GLfloat p
[1]
#define Q_OBJECT
#define slots
double qreal
Definition qtypes.h:187
QWasmWindowTreeNodeChangeType
QLayoutItem * child
[0]