Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qohosinputmethodproxy.h
Go to the documentation of this file.
1// Copyright (C) 2025 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 QOHOSINPUTMETHODPROXY_H
5#define QOHOSINPUTMETHODPROXY_H
6
7#include <QtCore/qglobal.h>
8#include <QtCore/qrect.h>
9#include <functional>
10#include <inputmethod/inputmethod_controller_capi.h>
11#include <memory>
12
14
15class QOhosInputMethodProxy
16{
17public:
18 class ClientCallbacks
19 {
20 public:
21 virtual ~ClientCallbacks();
22
23 virtual void onInsertText(std::string text) = 0;
24 virtual void onInsertPreviewText(std::string text) = 0;
25 virtual void onDeleteForward(int length) = 0;
26 virtual void onDeleteBackward(int length) = 0;
27 virtual void onSendKeyboardStatus(::InputMethod_KeyboardStatus keyboardStatus) = 0;
28 virtual void onSendEnterKey(::InputMethod_EnterKeyType enterKeyType) = 0;
29 virtual void onMoveCursor(::InputMethod_Direction direction) = 0;
30
31 protected:
32 ClientCallbacks();
33 };
34
35 QOhosInputMethodProxy(
36 std::shared_ptr<ClientCallbacks> clientCallbacks,
37 ::InputMethod_RequestKeyboardReason requestKeyboardReason);
38 bool hasAttachedSuccessfully();
39
40 void showTextInput(::InputMethod_RequestKeyboardReason requestKeyboardReason);
41 void notifyConfigurationChange(
42 ::InputMethod_EnterKeyType enterKeyType, ::InputMethod_TextInputType textInputType);
43 void notifyCursorUpdate(const QRectF &cursorRect);
44
45private:
46 struct JsScopeData
47 {
48 struct JsTextEditorProxyData
49 {
50 bool textInputShown = false;
51 };
52
53 std::shared_ptr<::InputMethod_TextEditorProxy> textEditorProxy;
54 std::shared_ptr<JsTextEditorProxyData> textEditorProxyData;
55 std::shared_ptr<::InputMethod_InputMethodProxy> inputMethodProxy;
56 std::shared_ptr<void> callbacksRegistrationHandle;
57 };
58
59 std::shared_ptr<void> registerCallbacks(
60 std::shared_ptr<::InputMethod_TextEditorProxy> textEditorProxy,
61 std::shared_ptr<JsScopeData::JsTextEditorProxyData> textEditorProxyData,
62 std::weak_ptr<QOhosInputMethodProxy::ClientCallbacks> weakClientCallbacks);
63
64 std::shared_ptr<ClientCallbacks> m_clientCallbacks;
65 std::shared_ptr<JsScopeData> m_jsScopeData;
66};
67
68QT_END_NAMESPACE
69
70#endif // QOHOSINPUTMETHODPROXY_H
QOhosFloatingWindow(QWindow *window)
~QOhosFloatingWindow() override
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
bool startSystemMove() override
Reimplement this method to start a system move operation if the system supports it and return true to...
QOhosView * ownedViewOrNull() const override
void onWindowStateChanged(Qt::WindowStates oldWindowState, Qt::WindowStates currentWindowState) override
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
void initialize() override
Called as part of QWindow::create(), after constructing the window.
void onWindowFlagsChanged(Qt::WindowFlags previousWindowFlags, Qt::WindowFlags currentWindowFlags) override
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
QOhosSurface * ownedSurfaceOrNull() const override
void setMask(const QRegion &region) override
Reimplement to be able to let Qt set the mask of a window.
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
void update(Qt::InputMethodQueries queries) override
Notification on editor updates.
QRectF keyboardRect() const override
This function can be reimplemented to return virtual keyboard rectangle in currently active window co...
void setSoftwareKeyboardVisibilityStatus(bool visible)
void showInputPanel() override
Request to show input panel.
void invokeAction(QInputMethod::Action action, int cursorPosition) override
Called when the word currently being composed in the input item is tapped by the user.
void setLastInputTypeToTriggerSoftKeyboard(RequestKeyboardReason inputType)
void reset() override
Method to be called when input method needs to be reset.
void hideInputPanel() override
Request to hide input panel.
bool isValid() const override
Returns input context validity.
bool eventFilter(QObject *obj, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
bool isInputPanelVisible() const override
Returns input panel visibility status.
QObject * focusObjectOrNull() const
void setFocusObject(QObject *object) override
This virtual method gets called to notify updated focus to object.
bool isAnimating() const override
This function can be reimplemented to return true whenever input method is animating shown or hidden.
std::enable_if_t< qohosplugincore_h_detail::isQOhosOptional< QOhosInvokeResult< Func, T > >, QOhosInvokeResult< Func, T > > andThen(Func &&func) const
void setDisplayIdFromOhos(QOhosOptional< QOhosDisplayInfo::JsDisplayId > displayId)
void initialize() override
Called as part of QWindow::create(), after constructing the window.
void notifyInputSystemsWindowActiveStatusChanged(bool active)
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
QOhosSurface * surfaceOrNull() const
void setWindowMask(const QOhosWindowProxy::WindowMask &windowMask)
void lower()
ViewGeometry viewGeometry() const
bool startMoving()
bool isSubWindowCoveringFullScreen() const
void raise()
static QWindowProxyRegistry & instance()
bool isWindowPcModeEnabled()
Combined button and popup list for selecting options.
bool isWindowRotatedByTabletScreenRotation(QWindow *window, QOhosWindowProxy::RectChangeOptions rectChangeOptions)
QOhosRuntimeDeviceTypeAndMode queryQOhosRuntimeDeviceAndMode()