Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwasminputcontext.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWASMINPUTCONTEXT_H
5#define QWASMINPUTCONTEXT_H
6
7
8#include <qpa/qplatforminputcontext.h>
9#include <QtCore/qpointer.h>
10#include <private/qstdweb_p.h>
11#include <emscripten/bind.h>
12#include <emscripten/html5.h>
13#include <emscripten/emscripten.h>
14
16
18{
19 Q_DISABLE_COPY(QWasmInputContext)
21public:
22 explicit QWasmInputContext();
23 ~QWasmInputContext() override;
24
25 void update(Qt::InputMethodQueries) override;
26
27 void showInputPanel() override;
28 void hideInputPanel() override;
29 bool isValid() const override { return true; }
30
31 void focusWindowChanged(QWindow *focusWindow);
33
34private:
35 emscripten::val inputHandlerElementForFocusedWindow();
36
37 bool m_inputPanelVisible = false;
38
39 QPointer<QWindow> m_focusWindow;
40 emscripten::val m_inputElement = emscripten::val::null();
41 std::unique_ptr<qstdweb::EventCallback> m_blurEventHandler;
42 std::unique_ptr<qstdweb::EventCallback> m_inputEventHandler;
43 static int androidKeyboardCallback(int eventType,
44 const EmscriptenKeyboardEvent *keyEvent, void *userData);
45 bool inputPanelIsOpen = false;
46};
47
49
50#endif // QWASMINPUTCONTEXT_H
The QPlatformInputContext class abstracts the input method dependent data and composing state.
\inmodule QtCore
Definition qpointer.h:18
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
void showInputPanel() override
Request to show input panel.
bool isValid() const override
Returns input context validity.
void hideInputPanel() override
Request to hide input panel.
void update(Qt::InputMethodQueries) override
Notification on editor updates.
void focusWindowChanged(QWindow *focusWindow)
void inputStringChanged(QString &, QWasmInputContext *context)
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
static void * context
#define Q_OBJECT