Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwasmintegration.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 QWASMINTEGRATION_H
5#define QWASMINTEGRATION_H
6
7#include "qwasmwindow.h"
8
9#include "qwasminputcontext.h"
10
11#include <qpa/qplatformintegration.h>
12#include <qpa/qplatformscreen.h>
13#include <qpa/qplatforminputcontext.h>
14
15#include <QtCore/qhash.h>
16
17#include <private/qsimpledrag_p.h>
18#include <private/qstdweb_p.h>
19
20#include <emscripten.h>
21#include <emscripten/html5.h>
22#include <emscripten/val.h>
23
25
26class QWasmEventTranslator;
28class QWasmWindow;
30class QWasmScreen;
31class QWasmCompositor;
33class QWasmClipboard;
34class QWasmAccessibility;
35class QWasmServices;
36
38{
40public:
43
47#ifndef QT_NO_OPENGL
49#endif
51 QPlatformFontDatabase *fontDatabase() const override;
54 Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const override;
55 QStringList themeNames() const override;
56 QPlatformTheme *createPlatformTheme(const QString &name) const override;
57 QPlatformServices *services() const override;
58 QPlatformClipboard *clipboard() const override;
59#ifndef QT_NO_ACCESSIBILITY
60 QPlatformAccessibility *accessibility() const override;
61#endif
62 void initialize() override;
63 QPlatformInputContext *inputContext() const override;
64
65#if QT_CONFIG(draganddrop)
66 QPlatformDrag *drag() const override;
67#endif
68
69 QWasmClipboard *getWasmClipboard() { return m_clipboard; }
70 QWasmInputContext *getWasmInputContext() { return m_platformInputContext; }
71 static QWasmIntegration *get() { return s_instance; }
72
73 void setContainerElements(emscripten::val elementArray);
74 void addContainerElement(emscripten::val elementArray);
75 void removeContainerElement(emscripten::val elementArray);
76 void resizeScreen(const emscripten::val &canvas);
77 void resizeAllScreens();
78 void updateDpi();
80 static quint64 getTimestamp();
81
83
84private:
85 struct ScreenMapping {
86 emscripten::val emscriptenVal;
87 QWasmScreen *wasmScreen;
88 };
89
90 mutable QWasmFontDatabase *m_fontDb;
91 mutable QWasmServices *m_desktopServices;
92 mutable QHash<QWindow *, QWasmBackingStore *> m_backingStores;
93 QList<ScreenMapping> m_screens;
94 mutable QWasmClipboard *m_clipboard;
95 mutable QWasmAccessibility *m_accessibility;
96
97 qreal m_fontDpi = -1;
98 mutable QScopedPointer<QPlatformInputContext> m_inputContext;
99 static QWasmIntegration *s_instance;
100
101 mutable QWasmInputContext *m_platformInputContext = nullptr;
102
103#if QT_CONFIG(draganddrop)
104 std::unique_ptr<QSimpleDrag> m_drag;
105#endif
106
107};
108
110
111#endif // QWASMINTEGRATION_H
\inmodule QtCore
Definition qhash.h:818
Definition qlist.h:74
\inmodule QtCore
Definition qobject.h:90
\inmodule QtGui
\inmodule QtGui
The QPlatformBackingStore class provides the drawing area for top-level windows.
The QPlatformClipboard class provides an abstraction for the system clipboard.
The QPlatformDrag class provides an abstraction for drag.
The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they ...
The QPlatformInputContext class abstracts the input method dependent data and composing state.
The QPlatformIntegration class is the entry for WindowSystem specific functionality.
Capability
Capabilities are used to determine specific features of a platform integration.
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
The QPlatformServices provides the backend for desktop-related functionality.
The QPlatformTheme class allows customizing the UI based on themes.
The QPlatformWindow class provides an abstraction for top-level windows.
\inmodule QtCore
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qvariant.h:64
QPlatformInputContext * inputContext() const override
Returns the platforms input context.
void setContainerElements(emscripten::val elementArray)
static QWasmIntegration * get()
Qt::WindowState defaultWindowState(Qt::WindowFlags flags) const override
QPlatformFontDatabase * fontDatabase() const override
Accessor for the platform integration's fontdatabase.
QPlatformOffscreenSurface * createPlatformOffscreenSurface(QOffscreenSurface *surface) const override
Factory function for QOffscreenSurface.
void addContainerElement(emscripten::val elementArray)
void initialize() override
Performs initialization steps that depend on having an event dispatcher available.
QWasmClipboard * getWasmClipboard()
QWasmInputContext * getWasmInputContext()
void removeContainerElement(emscripten::val elementArray)
QAbstractEventDispatcher * createEventDispatcher() const override
Factory function for the GUI event dispatcher.
QStringList themeNames() const override
QPlatformOpenGLContext * createPlatformOpenGLContext(QOpenGLContext *context) const override
Factory function for QPlatformOpenGLContext.
void removeBackingStore(QWindow *window)
QPlatformBackingStore * createPlatformBackingStore(QWindow *window) const override
Factory function for QPlatformBackingStore.
static quint64 getTimestamp()
QPlatformServices * services() const override
QPlatformClipboard * clipboard() const override
Accessor for the platform integration's clipboard.
QPlatformTheme * createPlatformTheme(const QString &name) const override
void resizeScreen(const emscripten::val &canvas)
QVariant styleHint(QPlatformIntegration::StyleHint hint) const override
bool hasCapability(QPlatformIntegration::Capability cap) const override
QPlatformWindow * createPlatformWindow(QWindow *window) const override
Factory function for QPlatformWindow.
QPlatformAccessibility * accessibility() const override
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
WindowState
Definition qnamespace.h:250
static void * context
GLbitfield flags
GLuint name
GLenum cap
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
#define Q_OBJECT
unsigned long long quint64
Definition qtypes.h:56
double qreal
Definition qtypes.h:92
aWidget window() -> setWindowTitle("New Window Title")
[2]