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
qwindowsinputcontext.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QWINDOWSINPUTCONTEXT_H
5#define QWINDOWSINPUTCONTEXT_H
6
7#include <QtCore/qt_windows.h>
8
9#include <QtCore/qlocale.h>
10#include <QtCore/qpointer.h>
11#include <qpa/qplatforminputcontext.h>
12
14
16class QWindowsWindow;
17
19{
20 Q_DISABLE_COPY_MOVE(QWindowsInputContext)
22
23 struct CompositionContext
24 {
25 HWND hwnd = nullptr;
26 QString composition;
27 int position = 0;
28 bool isComposing = false;
29 QPointer<QObject> focusObject;
30 };
31public:
32 explicit QWindowsInputContext();
33 ~QWindowsInputContext() override;
34
35 static void setWindowsImeEnabled(QWindowsWindow *platformWindow, bool enabled);
36
37 bool hasCapability(Capability capability) const override;
38 QLocale locale() const override { return m_locale; }
39
40 void reset() override;
41 void update(Qt::InputMethodQueries) override;
42 void invokeAction(QInputMethod::Action, int cursorPosition) override;
43 void setFocusObject(QObject *object) override;
44
45 QRectF keyboardRect() const override;
46 bool isInputPanelVisible() const override;
47 void showInputPanel() override;
48 void hideInputPanel() override;
49
50 bool startComposition(HWND hwnd);
51 bool composition(HWND hwnd, LPARAM lParam);
52 bool endComposition(HWND hwnd);
53 inline bool isComposing() const { return m_compositionContext.isComposing; }
54
55 int reconvertString(RECONVERTSTRING *reconv);
56
57 bool handleIME_Request(WPARAM wparam, LPARAM lparam, LRESULT *result);
58 void handleInputLanguageChanged(WPARAM wparam, LPARAM lparam);
59
60private slots:
61 void cursorRectChanged();
62
63private:
64 void initContext(HWND hwnd, QObject *focusObject);
65 void doneContext();
66 void startContextComposition();
67 void endContextComposition();
68 void updateEnabled();
69 HWND getVirtualKeyboardWindowHandle() const;
70
71 const DWORD m_WM_MSIME_MOUSE;
72 bool m_caretCreated = false;
73 HBITMAP m_transparentBitmap;
74 CompositionContext m_compositionContext;
75 bool m_endCompositionRecursionGuard = false;
76 LCID m_languageId;
77 QLocale m_locale;
78};
79
81
82#endif // QWINDOWSINPUTCONTEXT_H
The QInputMethodEvent class provides parameters for input method events.
Definition qevent.h:625
Action
Indicates the kind of action performed by the user.
\inmodule QtCore
Definition qobject.h:103
The QPlatformInputContext class abstracts the input method dependent data and composing state.
\inmodule QtCore\reentrant
Definition qrect.h:484
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Windows Input context implementation.
QLocale locale() const override
QRectF keyboardRect() const override
This function can be reimplemented to return virtual keyboard rectangle in currently active window co...
void update(Qt::InputMethodQueries) override
Moves the candidate window along with microfocus of the focus object.
bool composition(HWND hwnd, LPARAM lParam)
Notify focus object about markup or final text.
bool hasCapability(Capability capability) const override
Returns whether the implementation supports capability.
void invokeAction(QInputMethod::Action, int cursorPosition) override
Called when the word currently being composed in the input item is tapped by the user.
void handleInputLanguageChanged(WPARAM wparam, LPARAM lparam)
void showInputPanel() override
Request to show input panel.
static void setWindowsImeEnabled(QWindowsWindow *platformWindow, bool enabled)
bool isInputPanelVisible() const override
Returns input panel visibility status.
void setFocusObject(QObject *object) override
This virtual method gets called to notify updated focus to object.
bool handleIME_Request(WPARAM wparam, LPARAM lparam, LRESULT *result)
int reconvertString(RECONVERTSTRING *reconv)
Determines the string for reconversion with selection.
void hideInputPanel() override
Request to hide input panel.
void reset() override
Cancels a composition.
Raster or OpenGL Window.
Combined button and popup list for selecting options.
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint64EXT * result
[6]
#define Q_OBJECT
#define slots