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
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/qstdweb_p.h>
18
19#include <emscripten.h>
20#include <emscripten/html5.h>
21#include <emscripten/val.h>
22
24
25class QWasmEventTranslator;
27class QWasmWindow;
29class QWasmScreen;
30class QWasmCompositor;
32class QWasmClipboard;
33class QWasmAccessibility;
34class QWasmServices;
35class QWasmDrag;
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 updateDpi();
78 void resizeAllScreens();
79 void loadLocalFontFamilies(emscripten::val families);
82 static quint64 getTimestamp();
83
85
86private:
87 struct ScreenMapping {
88 emscripten::val emscriptenVal;
89 QWasmScreen *wasmScreen;
90 };
91
92 mutable QWasmFontDatabase *m_fontDb;
93 mutable QWasmServices *m_desktopServices;
94 mutable QHash<QWindow *, QWasmBackingStore *> m_backingStores;
95 QList<ScreenMapping> m_screens;
96 mutable QWasmClipboard *m_clipboard;
97 mutable QWasmAccessibility *m_accessibility;
98
99 qreal m_fontDpi = -1;
100 mutable QScopedPointer<QPlatformInputContext> m_inputContext;
101 static QWasmIntegration *s_instance;
102
103 mutable QWasmInputContext *m_platformInputContext = nullptr;
104
105#if QT_CONFIG(draganddrop)
106 std::unique_ptr<QWasmDrag> m_drag;
107#endif
108
109};
110
112
113#endif // QWASMINTEGRATION_H
\inmodule QtCore
Definition qobject.h:103
\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
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
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
void loadLocalFontFamilies(emscripten::val families)
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:251
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:61
double qreal
Definition qtypes.h:187
aWidget window() -> setWindowTitle("New Window Title")
[2]